fix goroutine leaks in tests