Fixed issue with module packaging

When packaging modules into an executable, the module packager would fail to generate a valid PowerShell script in certain circumstances.