Handle errors from writeBuffer calls.