I used to have that problem too. I have sugar ants and they will chew tiny little holes in ziploc bags, candy wrappers. cereal bags, etc. If they want in, they find a way. I now put everything that they may like in Rubbermaid containers. Large jars with tight fitting lids can also be used.
As soon as I get home from the grocery store, everything gets opened and put into the air tight containers. I still see some ants in the pantry scouting around, but only a few.
I guess they are trying to figure out where their food supply went. If you do find the tiny hole that they are coming in through, make sure to use a bug spray on it before you seal the hole because they will just chew through the caulk. I use an old diabetic needle to inject the bug spray in the holes. (I use a concentrate bug killer that has to be diluted with water). It's better than spraying the surface of the wall.
The bug killer gets them where they live in that little hole when you can inject it in there. Hope I helped out in some way.