Add 'make before-push' target.
Ensure that we close all files. Add close methods to appropriate classes, and
make classes that have close methods in to context managers, so that they can be
used with `with` statments.