Remove more race conditions in TestLeave.