How to prevent SQLite from blocking while using R? I am doing an infinity loop to keep gathering data from database db, rework it and send it to another database db1

library(DBI)
library(RSQLite)


while(1==1){

  db = dbConnect(SQLite(), dbname="Data.sqlite",synchronous = NULL)
  db1 = dbConnect(SQLite(), dbname="Data2.sqlite",synchronous = NULL)
  db1
  db

Column1=dbGetQuery(db,'select * from Table1')

  #Here is some calculations#

    Result = Column1/10

  #Here calculations are finished and ready to be sent to new database#

dbWriteTable(db1, name="Result", value=Result, row.names=TRUE, append=TRUE)
   dbDisconnect(db1)
   dbDisconnect(db)
}


when I run the code, it executes about 10 loops and then rise the following Error: Error in rsqlite_send_query(conn@ptr, statement) : database is locked

Can someone please help me to solve this problem
I solved the problem by opening the database from sqlitebrowser and typing the following query there: pragma journal_mode=wal;

for more info: https://www.sqlite.org/wal.html