Make sure AgentServer actually executes shutDown

any reason for two ifs instead of this?

    if (server != null && !server.isStopping())