Wrap 'PRAGMA journal_mode=WAL' in a retry loop