fixing crash

Ironically, the crash happened when trying to close the application
(HAHA)