Fixed a bug when exiting the application doesn't really exit.