Clean up the main window.