@Jessica Bradford good question and honestly one that comes up more than you'd think with supercap-based systems.
The supercap is actively supplying the module during the flash cycle — the STLink side handles the programming interface but it's not a dedicated power rail that bypasses the cap. So if your cap was partially discharged when you started that session, a voltage dip mid-write is a very real possibility, especially since flash operations tend to pull a bit more current than idle. The classic sign of this is exactly what you described — a mid-write reset rather than a clean fail at the start.
Before your next flash session, make sure the cap is at full charge first (the 5-minute charge gets you there), and if you can, try to avoid flashing immediately after a long runtime where the cap's been depleted. That should eliminate the voltage-dip scenario as the culprit — if you still get mid-write resets after that, then it's more likely a timing or connection issue on the STLink side worth digging into separately.