Added code to terminate any browser processes before cleaning the profile (as a sanity check against crashed tests).