check if connection is open when writing to transport

instead of checking if it is closed
fixes ruby-amqp/bunny#135