Fix memory leak in channel timeout

Channel was not being properly closed on channel timeout. Close was
issuing flush, which wait for the channel to empty its output buffer.
For a channel in timeout (or error) state, this would wait forever
and leave the channel in closing state and preventing the output
buffer from being freed.
Merge branch 'timeout-memory-leak'