This isn't true of human doors; insects are very small.
We've had the technology to keep things in wax-sealed clay jars for quite a while, but I'm not aware that this was done with grain, where preventing spoilage would have been most valuable. Granaries are open to the air. (And devote quite a lot of effort to slowing the spoilage of the grain.)
If you wanted food that wouldn't rot, instead of keeping it in an airtight environment, you dried it.
If I have to survive the night, overhead protection and thermal insulation is more important than a fire. Source: I've tried using both without the other.