closing socket gracefully, do not end if something breaks