window was being destroyed twice, causing a crash on exit