Hi asgarcymed,
As I said, there are no script APIs (that I know of, anyway) that allow you to "free" memory. In addition, the notion of "free" memory is not really that straightforward. For example, Windows handles swap file space as an extension of physical memory. I think you're stuck with closing programs you don't need or optimizing your script.
Bill