add waitForClosed