Many generations of Microsoft’s OS have taught PC users that clicking on the red X in the top right corner of the window closes a program. Not so with OS X. Unlike with Windows, clicking on the red circle at the top left of the window on Macs only closes the window itself, not the program. To fully exit an application, follow these steps:
1. Click on the name of the program just to the right of the Apple icon at the top left of the screen.
2. Select Quit [program name] at the very bottom of the drop-down menu.
3. Use the keyboard shortcut Command-Q to close the program, as an alternative.
If you want to close all of the windows of an open application without terminating the program itself, you can use the shortcut Command-Option-W.
(such as if you want to leave the Messages app running in the background),