Waiting for user to click on X to close the window