Test that flushing lots of writeRecords doesn't overflow the stack