I determined the problem yesterday. The script was being launched from an application directly, and it was that application that wouldn't let the script stop executing until the browser window had been closed. When I disable the application's "Capture Output" option, it works fine.
The first way you poined out results in a "Bad Command or Filename" on my system, but your second suggestion works just as well as the one I'm using now, so I'll switch to it.