Update stat data on flush and not for each write

This should greatly reduce the number of IndexedDB transactions we create.
I would call the callback in a timeout here so *stat* always returns before calling the callback.