Fix indefinite hanging after completed test case