Make app close properly and clean up code