Rework shutdown

This set of patches is intended to make sure that the agent will reliably stop after a reasonable time if it has been requested to, even in some corner cases.

I removed the counting of shutdown requests: One request needs to be enough in case of for example a shutdown of the host or an automated restart.
That's because this method gets called from the /stop api endpoint, and if it stops the reactor before it returns, the endpoint won't be able to return an answer to the caller.

On second thought, it might be better to have the endpoint wrap the call to Agent.stop in reactor.callLater instead.