gracefully shut down the test client and wait