made the app not crash for closing the app