Attempt to close socket gracefully on error.

Minor documentation cleanup.