When you hit "Exit" in the dropdown, or hit the X button - the program exits immediately.
When you try to open another file after making edits, it prompts that you have unsaved changes and asks you to save.
Exiting the program should have similar functionality.