Closing socket on read error to cancel pending sends