Handle errors during socket shutdown() or close().