Mylar bags with some oxygen absorbers thrown in do the trick. You should put the bags into a 5 gallon bucket or some similar container before you fill them so that they don't get punctured. The heat sealed bags work best and freezing the flour prior to packing will kill any bugs that are there already.
To kill the larvae, first freeze the flour for 24-48 hours, then vacuum/co2 pack it as needed.