Fix to make sure file actually gets written out.