agent: stop units in goroutine during init

Fix #624