make window closing/switching code more robust
make window closing/switching code more robust

The code didn’t reliably work with the latest Firefox and Selenium
webdriver versions.
MiltosD/CEF-ELRC,MiltosD/CEF-ELRC,MiltosD/CEFELRC,MiltosD/CEF-ELRC,JuliBakagianni/META-SHARE,zeehio/META-SHARE,MiltosD/CEFELRC,MiltosD/CEF-ELRC,JuliBakagianni/META-SHARE,JuliBakagianni/META-SHARE,zeehio/META-SHARE,zeehio/META-SHARE,MiltosD/CEF-ELRC,JuliBakagianni/CEF-ELRC,JuliBakagianni/CEF-ELRC,JuliBakagianni/META-SHARE,JuliBakagianni/CEF-ELRC,JuliBakagianni/CEF-ELRC,MiltosD/CEFELRC,zeehio/META-SHARE,MiltosD/CEFELRC,JuliBakagianni/META-SHARE,JuliBakagianni/CEF-ELRC,JuliBakagianni/CEF-ELRC,MiltosD/CEF-ELRC,zeehio/META-SHARE,zeehio/META-SHARE,MiltosD/CEFELRC,JuliBakagianni/META-SHARE,MiltosD/CEF-ELRC,MiltosD/CEFELRC,JuliBakagianni/META-SHARE,JuliBakagianni/CEF-ELRC,MiltosD/CEFELRC,zeehio/META-SHARE