This needs more explanation on the attached "database file".
Is it a text file with Prolog source code?
reveals that it uses Prologs term reading & writing:
sufficient for simple applications I guess. But once you need versioning and surety regarding massacred files because the process crashed, you have to look for more.
How about a file managed by an in-process database library like SQLite? You get transactions, memory-mapping, speed, pre-defined file format, metadata etc. for free (i.e. one of those: https://en.wikipedia.org/wiki/List_of_in-memory_databases ). A juicy development task ~~~
Prolog database operations like retract/assert[a|z] etc. are named, link:
library(record) is named, here is the link: