Fixed bug relating to rewriting empty workbooks. The aggregates were not being added to the records in this case.