Added alert before exiting