Fix bugs with channel close/cancel