Modified CloseCommand to use Platform.exit()