Word of encouragement - Many accidents can be recovered from, even overdosing with K-Meta. Ants and fruit flies maybe not.
But for the future Sanitize the Cr@p out of your work area, floor counters etc. Before and after working. Ant follow trails and while they can find stuff on their own... they usually follow traces of food/sugar. If you think you have ants in the area, set out bait traps as far away as possible from your work area and watch them, Also put them outside the house. Keeping them out is better than killing them once they are inside. For fruit flies ALWAYS cover your buckets with a cloth and tightly tied cord securing the cloth. Lids, are a royal PITA to take off and put on and they still leak anyway. Check your airlocks daily if you observing lots of fruit flies. They will infiltrate the airlock and die but you still want to keep them and any of their bacteria well away from the wine.
I have recently been seeing fruit flies land on the cloth of my buckets. I've killed a few but mainly I try to recover the bucket immediately even if I'm working on an addition or measurement.
Keep working at it. Most all of us have made our fair share of mistakes along the way. Unless you have an experienced coach standing at your side it's so easy to miss something along the way, or break a vital container or have equipment die on you etc.