Fix crash on close #255
Merge pull request #501 from ctrlaltca/crash_on_exit

Fix crash on close #255