TermSession: avoid deadlock on large writes to/from the emulation client

Have ByteQueue's write() return when the queue fills up during a write
instead of blocking, allowing TermSession to signal the reading thread
to clear the queue first before continuing.  Should fix the deadlock
reported in #198.