You cannot makes scripts run forever. Yes, the will stop when the browser is closed.

There is also a 30 second timeout on loops.