1. Ensure that failed writes don't leave the write queue in an inconsistent
state. Before, write requests were handed back to the user but were not
removed from the write queue. The cause of at least one use-after-free bug.
2. Pass the error to the callback on the next iteration of the event loop
instead of returning it immediately.