datastore: Fix races caused by Goroutine leaks blocking database requests
There's multiple races in our datastore tests causde by Goroutine leaks. First, listeners aren't explicitly closed, but are only closed by context cancellation. As we thus cannot synchronize with them exiting, they may live longer than the surrounding test. And second, we didn't wait for some Goroutines to exist. Both issues are fixed by this MR.