That's because the
count command relies on the leader knowing about the unit being dead.
Like when you're playing and you get all the "Oh no, 3 is down" radio messages.
Sometimes it takes a while to trigger.
Try this instead:
(West countside units
gr1 == 0) and (West countside units
gr2 == 0)
Obviously if the side of the units isn't west then change that to east or resistance