Like Judith I give my flour a run through the freezer when I bring it home. It goes in for at least 24 hours, but most often it stays there until I need to open a new package. Then it's stored in an airtight container. I haven't had any bug issues since I started doing this.
(Note: let the flour come to room temp before baking with it or it will add considerably to baking time. Learned that the hard way.

)