Fixed a race condition with session choking.

If a slave manages to send the close event before the client closes its
part of the stream, then there's a race condition which sometimes leaves
sessions not closed forever.