Make sure server exists before all connections are closed