Fix assertion failure on connection write error.

Connection::on_write on failure attempts to transition the state from REQUEST_STATE_WRITING to REQUEST_STATE_DONE. This caused Connection::Request::change_state to immediately kill the application with assert(false && "Invalid request state after writing").