Fix stopApplication to use session ID