Feature/perf tweaks

Several performance tweaks:

* Remove global locks
* Add specific locks in create_doc and update_indexes
* Enable WAL mode