Flatworm exit will exit your entire tank unless you follow the directions carefully

Flatworms are toxic, and when they die, they release the toxins into the tank. And not all fish can eat them, again, toxicity.
They aren't a nutrient thing that will go away. Try manually removing as many as you can, then try the suggested fish (some wrasses I think) to control them.