Network.InitializeServer STOP listening on port ??

How do I STOP the server from listening on ports?
I want to stop the server from listening and make it now act as a client, but how?

Network.Disconnect();” crashes the Unity editor.
I call that method in “void OnPlayerDisconnected(NetworkPlayer player)” because I want the server to stop when the client disconnects… but there is no method I can find for this?

K found a workaround.

Add the method:

void OnPlayerDisconnected(NetworkPlayer player)
{
MasterServer.UnregisterHost();
StartCoroutine(stopServer());
}

IEnumerator stopServer()
    {
        yield return new WaitForSeconds(1);
        Network.Disconnect();
    }