Reimplement close event of the main window
If the main window is closed while writing is in progress, a confirmation message will be shown instead of closing the window right away.