Mostly improve regression tests.  And close some data files after writing