How to modify a trajectory and animate it without "inconsistent trajectory" message

I have a trajectory (.xtd) of a system with interesting bits and a bunch of solvent. I want to delete the solvent molecules and animate the trajectory of what is left. I have written a script (stealing liberally from others here) that seems to do the deleting, but when I'm done, I can't animate the trajectory. In addition, I'd like to do the deletions on a *copy* of my original trajectory so that I don't destroy the original one.  How do I properly make a copy of a trajectory (giving it a new name) and how do I delete molecules within that trajectory and still animate it?  Thanks. I can't say that I understand the relationship between .xtd, .trj, and .msi or whatever files, so some of my problem likely lies there. Here are re relevant pieces of my script so far:

my \$xtd = "my_test";  # Name of the trajectory
my \$solvent = "Sketch 16"; # Set name given to the molecule
my \$start_frame = 1;  # Starting frame
my \$interval = 1;  # Extraction interval from the trajectory


#############################################################################

# Initialize

my \$doc = \$Documents{"\$xtd.xtd"};
print "Document: \$xtd.xtd\n";
my \$number_of_frames = \$doc->Trajectory->NumFrames;
print "Number of frames = \$number_of_frames \n";

###########################################################################
# Go through frames as instructed, delete the molecule

for (my \$frame_counter = \$start_frame; \$frame_counter <=\$number_of_frames; \$frame_counter = \$frame_counter + \$interval) {

print "Deleting \$solvent from frame \$frame_counter\n";

for my \$molecule (@{\$doc->UnitCell->Molecules}) {
     if ((\$molecule->Name eq \$solvent)) { \$molecule->Delete;}
}

}

print "Deletion complete\n";