Core/NetworkIO: Prevent double closing the same socket