Prevent a crash when exiting while the settings window is open.