If my necromancer dies, do my animated dead stay under my control?

From what I understand the undead created via animated dead are under my PC’s control indefinitely. So if I had commanded them to kill enemies of mine (insect things that were fighting our group so I commanded them to attack the bugs) would they follow that command after I die, or become uncontrolled and attack my party members too?

I had assumed that they became uncontrolled, and they attacked the party (which teleported away), but after looking while they were figuring out what to do next, I had re-read animated dead to figure out if that was correct.

The other thing that I was curious is do they stay under my control when brought back to life too?

If they do go uncontrolled after death, that would mean any necromancer PC would be a group wipe if they die.

I’ve been looking for an answer to this on the internet and the D&D books.