Fix lots of unrelated data races

This seems like a weird construct that we would defer the wait for the template to be stopped. Is this just to ensure that between tests the template is fully cleared out?