Fix main window broken after modal is closed