check if connection is open when writing to transport

instead of checking if it is closed
fixes ruby-amqp/bunny#135
Update recovery examples to changes in the previous commit