Make the decision of whether to close the window after each test configurable per-browser.
Experimental change to be more robust when waiting for Gaia homescreen.
Clean up some pyflakes issues