Add `quit command and actually terminate when the connection is closed