Resolve the bug of closing the app without confirmation.