The standard Quit, quit(), exit, exit(), Ctrl-Z and Ctrl-Z do not work.
By typing help you should get the information on how to quit out of the terminal session.
Check the DigiESP for Python guide under :section 3.5.1.2. Telnet Connection Settings".
Do this:
import sys
sys.exit()