WaitForEventAndClose