Bug 851557: wait for selection before closing the opened window