When you execute the MATLAB program for the first time you are given a command window and four pull down menus: FILE, EDIT, OPTION, and WINDOW.
(Screen shot.)
To exit MATLAB simply select QUIT under the FILE pull down menu.