add locks for create_doc and update_indexes. Closes: #5139

This solves a InterfaceError (sqlite error code 21)
we were having with massive concurrent creation/puts.
Set Write-Ahead Logging

with autocommit set to 50 pages, a value that will permit fast reads.
also set synchronous mode to normal on regular operation.
changes file