Added a static function in the Application class to close the application