trying to catch an error when the browser window closes, and the python script freezes. not woring yet.