Session Stop Function?

Is there an availabkle method to simply cause a session to stop after xx loops?

For example:

if (counter > 5)
session.breakpoint();
else
session.scrapeFile("abcxyz");

This works, but does not seem top free up my sessions when I run it from a command/batch.

Is there something like

session.end
session.stop
session.terminate

Please advise.

Thanks.

Here's a link to the

Here's a link to the API:

http://community.screen-scraper.com/API/stopScraping