Auto-translated
The problem is solved!
I failed on the first try. Back then, no one left after the gates were destroyed for a long time, which allowed the archers to continue eliminating enemies. And then everyone started rushing out again, but they were hindering each other. It's some kind of unbalanced AI.