A more responsive way to wait for the program we're wrapping to have a main window.