Using c++11 now and fixed the app close bug