Creating multiple result trajectory files

Hi, I want to perform NPT MD Calcululations using Forcite and I want to store the result of each calculation in a separate file. I wrote a script where I take initial structure Input_filse.xsd, then I run one NPT to produce SubFile_0.xtd and then 4 different runs with 4 different temperatures creating files SubFile1-4.xtd. Problem is that when i run the script it creates Initial_file.xtd (no idea why, could not find in API info) and 5 subfiled Sub_File0-4.xtd but empty. Do you know the solution to problem?

#!perl

use strict;
use Getopt::Long;
use MaterialsScript qw(:all);

my \$T_init = 298;
my \$T_final = 600;
my \$no = 80;
my \$FF = "COMPASS";
my \$doc = \$Documents{'Initial_file.xsd'};


my \$results = Modules->Forcite->Dynamics->Run(\$doc, Settings(
CurrentForcefield => \$FF,
Ensemble3D => "NPT",
Temperature => \$T_init,
Thermostat => "Nose",
Pressure => 0.000101,
NumberOfSteps => 10,
TrajectoryFrequency => 5,
StressXX => -0.000101,
StressYY => -0.000101,
StressZZ => -0.000101));
my \$outTrajectory = Documents->New("SubFile_0.xtd");
\$outTrajectory = \$results->Trajectory;



for ( \$i = 1;\$i<=4;++\$i) {
my \$results = Modules->Forcite->Dynamics->Run(\$outTrajectory, Settings(
CurrentForcefield => \$FF,
TrajectoryRestart => "Yes",
AppendTrajectory => "Yes",
Ensemble3D => "NPT",
Thermostat => "Nose",
Temperature => \$T_init-5*\$i,
Pressure => 0.000101,
NumberOfSteps => 10,
TrajectoryFrequency => 1,
StressXX => -0.000101,
StressYY => -0.000101,
StressZZ => -0.000101));
my \$outTrajectory = Documents->New("SubFile_".\$i.".xtd");
\$outTrajectory = \$results->Trajectory;

print \$i."\n";
}




Lukasz