Handles exception when user inputs an invalid operation and exits the program