[Minor] better error handling when the agent does not start

Should the agent not be able to start due to configuration problems, 
then the agent must still be stopped, thus state changes in this context
should not lead to exceptions when shutting down.