See https://sqlite.org/howtocorrupt.html for an overview of the most common causes of database file corruption.