Fix race condition in telnet transport teardown. (@Hodgestar)