Closing a File
Click Close file in the toolbar to return to the empty, no-file-open state - useful when you want to start fresh without picking a different file right away.
If you have unsaved changes, you're asked whether to save first, discard them, or cancel closing.
Closing the file also clears the undo/redo history, so it doesn't carry over into whatever you open next.
Closing the whole app
Closing the window itself (the X button, or Alt+F4) works the same way - if you have unsaved changes, you'll see the same save/discard/cancel prompt before the app actually exits, so nothing gets silently lost.