utils.py: Wait for threads to exit in _is_single_threaded()
gRPC threads are not joined when shut down.
This should fix _is_single_threaded() assertion failures in the tests-buildbox CI job. I wasn't able to reproduce the issue locally but I've tested this with multiple CI runs.