The loop correctly finds that epoch 2 had the best validation loss (0.65) — and then restores the LAST checkpoint, from epoch 5, where validation had already climbed back to 0.85. Training past the turn is fine; KEEPING the post-turn weights is the bug early stopping exists to prevent. Restore the best-validation checkpoint.
The break is on line 9 — but read the whole snippet first.