Make sure AgentServer actually executes shutDown

Don't think it matters much in this context, but using AtomicBoolean.compareAndSet would remove a small race condition.