Fiddle with Firefox profile scope to keep temp dir around
Previously, when the $profile var in setup_firefox_env_vars went out of
scope at the end of the function, its File::Temp->newdir also went out
of scope and was getting automatically cleaned up. However, we need to
keep the profile directory around until the end of the script since
Firefox needs to be using it the entire time.
So, we've moved profile out of the function so it isn't DESTROY'd until
the end of the script's life time. However, we're running into a race
condition where the Firefox binary is still running while Perl is
DESTROYing everything - so the files in the tempdir are locked. We can't
delete them until after the Firefox process dies...