Defunct connection when internal query fails

Errors that occurred during wait_for_responses(), which is used by the
control connection and for preparing statements, were not causing the
connection to be closed or defuncted.