I was able to create another issue with simpler g-code. When cancelling the print during the while loop, selecting the file for printing again will resume from the cancel location instead of starting from the beginning. I let the print finish executing the rest of the loop and then attempted to print again, but was met with the error: variable 'parts' already exists. It is impossible to start the print from this point without an E-stop or an M999 command.
echo "Begin" var parts = 0 while var.parts < 5 G1 X0 Y0 Z20 F3000 G1 X30 G1 Y30 G1 X0 G1 Y0 G10 P2 L20 X-50 Y0 Z20 set var.parts = var.parts + 1 echo "end" M0MicrosoftTeams-image (16).png