BZ 987628 - Agent can block indefinitely at startup

It appears the agent doesn't care that registration fails. The agent will
simply retry 5 times every 10 seconds, then the agent will block forever
waiting for the server to ping it, which won't happen.

This change basically forces a complete shutdown after registration fails and
displays an error as such.

There are a couple of cleanup things done for concurrency reasons as well.
BZ 987628 - Agent can block; Mars Rover behavior - retry forever

This patch makes the agent continue to try to connect, except in these cases:
1) The Agent object fails to construct.
2) The Agent is not the right version and cannot upgrade.
3) The Agent lost its token or has the wrong token
4) 'HelpException' - which happens through the command line interface