I've attached two scripts: nocrash.script and crash.script, both derived from the TESS end-to-end optimization script.
Here's the diff between the two scripts:
crash.script has one additional line, in the second Optimize sequence, that saves the Earth altitude of the spacecraft to a variable.
This variable is not used anywhere in the Optimize sequence. But, its presence changes the results!
Without the line, I get a line search error in iteration 80. With the line, I get an integrator error at the same place, followed by a crash. GMAT's memory usage at this point is elevated (111 MB), but stable.
The script takes nearly 30 min to run, so I attached a log file and some debug output to trace where the crash happens. The debug output simply logs the location and state after each Propagate statement.