Write restart files just before the simulation stops after the maximum number of time step divisions has been reached.