Close the app when closing the main window.