minor change. Sends disconnect request on bad write to socket, and stops the reading processes and future writes.