Keystroke: ⌘ + W
If you have not changed the content of a file, it closes immediately. Otherwise, the above dialog appears to allow you to save your changes. It contains the buttons, Yes, No, and Cancel.
Yes (or y): saves your changes. If your document has not previously been saved, you will be shown a second dialog box to prompt you for a file name.
No (or n): discards any changes you have made and closes the file.
Cancel (or c): This choice leaves the file open and takes you back to the editing window.