Properly shutdown the network on client exit