Check for write error - eg when connection has closed already.