After hitting 'esc'ESC (or cmd Ccmd + C on my computer) you must hit ':': for the command prompt to appear. Then, you may enter 'quit'quit.
You may find that the machine will not allow you to quit because your information hasn't been saved. If you'd like to quit anyway, enter '!'! directly after the quit (i.e. ':quit!':quit!).