title: Database disk image is malformed from many concurrent writes
body: <p>I'm running many (18k) batch jobs on a cluster with a Lustre filesystem. The jobs are submitted at the same time, each takes about 3 seconds, and they write the result using the <code>sqlite3</code> python module. The write part of the code is very simple: </p>
  
  <pre><code>with sqlite3.connect(name, timeout=900) as conn: 
      conn.execute(
          "insert into someTable values (?, ?)", (value1, value2))   
  </code></pre>
  
  <p>but a lot of the jobs will throw an exception: </p>
  
  <pre><code>sqlite3.DatabaseError: database disk image is malformed
  </code></pre>
  
  <p>and sometimes</p>
  
  <pre><code>sqlite3.OperationalError: unable to open database file
  </code></pre>
  
  <p>I'm guessing this has something to do with lots of jobs putting a lock on the file when they write to it, but my impression was that <code>sqlite3</code> should know to wait patiently for the file to be free. Is my error likely a result of too many concurrent writes? How can I fix it? </p>