One handy way to do this is to set up all your "clean up" activity in a batch file. Once you've tested it to run, put the "c:\program files\procomm\programs\pw4.exe" as the first line of your batch.
From here on out use the batch to start Procomm. The batch will hold processing until the first line completes. So, once Procomm shuts down, your cleanup runs.
This works quite well on a Win2K machine. But be aware, if you run multiple instances of procomm this may not work. Something about muliples program occurrences lets the batch continue whether procomm ends or not.
Also, if youu want to have it start with a specific script, put the "script.wax" after the pw4.exe, but inside the quotes.
I hope that helps!