Fix wg race

Race detector caught this when I was writing new code using the embedded client/coordinator (that PR coming soon).

This is super tricky and subtle and would deadlock if I did it wrong so... have fun reviewing!

(Lines 356-362 are technically unrelated to the race condition. Just enforcing invariants.)
maybe worth adding a comment to this Note http://golang.org/src/sync/waitgroup.go?s=1710:1745#L40