Working code for exit command