- added some socket handling after the server is shut down