fixed race condition on channel close when using gevent