Python will eventually close open files, but it is recommended to
explicitly close them instead of waiting for the gc or program exit.
This fixes all the uses of open...read/write in the codebase, mostly in
tests.
It isn't always obvious what happened when the rootfs runs out of space,
especially when using lorax via pungi. So this checks for the out of
space error string when building the runtime image and logs it to the
primary logfile and console as an error with the rootfs size.
eg.
2020-01-20 18:52:58,920: The rootfs ran out of space with size=1