daemon: handle IO error when processing wire buffer
This fixes the following assert:
daemon/worker.c:1157: qr_task_finalize: Assertion `!session_flags(source_session)->closing' failed.
Scenario which leads to the above error:
1. We're using a stateful protocol.
2. Enough data arrive in a single tcp_recv() call to put at least
two queries into the session's wire buffer.
3. session_wirebuf_process() calls worker_submit() which calls
qr_task_step().
4. In the qr_task_step() the query state changes to KR_STATE_DONE,
then qr_task_finalize() is called.
5. qr_task_send() is called, but it fails. This is where
qr_task_finalize() closes the session, but used to return no error.
6. When the next query is processed in session_wirebuf_process(),
steps 3 and 4 are followed and qr_task_finalize() is called.
7. Since the session is already closed, the assert is triggered.
Debugging this was a lot of fun... All hail the rr debugger!