Better cleanup in test_random.