Reinstated commitRecords because removing it, though beneficial performance-wise, caused problems with saving documents.