Fix a timing issue with cleanup tests