title: SQLite issue - DB is locked workaround
body: <p>I have 2 processes that connect to the same DB.
  The first one is used to read from the DB and the second is used to write to the DB.
  The first process sends write procedures for executing to the second process via message-queue on linux.</p>
  
  <p>Every SQL-statement is taken in the prepare, step, finalize routine; Where the prepare and step are made in loop of 10000 times till it succedd (did this to overcome DB locked issues).</p>
  
  <p>To add a table i do the next procedure:</p>
  
  <ol>
  <li><p>the first process sends request via msg-q to the second process to add a table and insert garbage in it's rows in a journal_mode=OFF mode.</p></li>
  <li><p>then the first process checks for the existing table so it could continue in its algorithm. (It checks it in a loop with usleep command between iterations.)</p></li>
  </ol>
  
  <p>The problem is that the second process is stuck in the step execute of 'PRAGMA journal_mode=OFF;' because it says the DB is locked (Here too, i use a loop of 10000 iterations with usleep to check 10000 time for the DB to be free, as i mentioned before).</p>
  
  <p>When i add to the first process in the 'check for existing table' loop, the operation of closing the connection, the second process is ok. But now when i add tables and values sometime i get 'callback requested query abort' in the Step Statement.</p>
  
  <p>Any help of whats happening here ?</p>