Closing socket if it EOFs