Gracefully shutdown, closing socket