agent: stop units in goroutine during init

Fix #624
Merge pull request #630 from bcwaldon/624

agent: stop units in goroutine during init