However, the code I wrote has a weak point. I suspect that you don't actually have 9999 archers. It will throw an error. You need to check the exact number of archers and subtract that exact number! If the point is that there should be no more of them in the army. But for now, just check without subtracting the archers.
It seems that the RemoveHeroCreatures command, if used to remove more creatures than the hero has, or even if used to remove creatures that the hero doesn't have at all, doesn't work.
Just in case, I checked without this line, and there is still no result.