Fixed race condition where stream fails while the session is terminating

Ignore-this: 3b9fbcc0552bdcc4e4e0faffa48d58e1

darcs-hash:20091127160145-1e3d8-db14d4aab0f9828f23d017fe450aa1bd7258a4b6