Fixed an issue with the new extension support for collecting stats on demand where it was breaking support for multi-step scripts (the code was processing the next step before it had finished closing out the previous one).