Flush unclosed files actively to work around bug #227.

The `RecordStore` and file system related java APIs use `finalize` to flush file data if a file isn't closed explicitly. Since we don't implement `finalize` (#227), we will lose file data in this case.

This pull request flushes the unclosed file periodically and ensures all files are saved before closed.
The flush on unload isn't going to work, unfortunately, per [Using IndexedDB](https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API/Using_IndexedDB):

> Second, you should never tie database transactions to unload events. If the unload event is triggered by the browser closing, any transactions created in the unload event handler will never complete. An intuitive approach to maintaining some information across browser sessions is to read it from the database when the browser (or a particular page) is opened, update it as the user interacts with the browser, and then save it to the database when the browser (or page) closes. However, this will not work. The database transactions will be created in the unload event handler, but because they are asynchronous they will be aborted before they can execute.