Call the error handler instead of throwing an exception when writing to a closed socket