Emit exit event when exiting