SQLite Forum

Why data is lost in SQLite database with WAL mode on when connection is not closed properly?
Login
By default, the WAL is not fsync'd after every transaction (transactions aren't guaranteed to be durable).

I suspect that the file is fsync'd when the connection is closed, but I didn't see that with a quick look at the documentation.

If

8. Close application (without closing Connection 1)

also involves crashing the OS, I'd say the behavior you describe is documented, unless you set pragma synchronous=FULL.

"A transaction committed in WAL mode with synchronous=NORMAL might roll back following a power loss or system crash."