Add accounting for two open files per database.  Add error if memory gets too low.