If they were escaping from the jars you could see holes in the cloth material you are using for a lid. They are escaping from the viv. All those plastic pieces on the top make for many holes/cracks around the rim. First off, the flies are attracted to light, so they climb up and find their way out. Then, they can be attracted back to their original jars from the smell of food.
Your jars are small and easily sealed. It would be very obvious to you if they were escaping from the jars. There would be no question.