made sure the socket gets closed