use a wait group to ensure node shutdown synchronously