Animate Dead says:
The creature is under your control for 24 hours, after which it stops obeying any command you've given it. To maintain control of the creature for another 24 hours, you must cast this spell on the creature again before the current 24-hour period ends. This use of the spell reasserts your control over up to four creatures you have animated with this spell, rather than animating a new one.
Animate Dead does not use concentration. It does not have a "duration," so one can't dispel it. And other than the undead being passive when not issued a command, it appears that even if the caster becomes unconscious, he doesn't lose control over the created skeletons or zombies.
There are effects in the game like the Oathbreaker's Control Undead or a Charm Monster spell, which can presumably wrestle control over a skeleton created with Animate Dead away from the necromancer. But is there any effect in the game (other than the 24 hours running out) that would cause a necromancer to lose his control over all the undead he made and controlled with Animate Dead?