index/write: make writing goroutine-safe
index/write: make writing goroutine-safe

This was useful for an evaluation I did where the index was created in
parallel.

lamby/dcs,jamessan/dcs,lamby/dcs,lamby/dcs,jamessan/dcs,jamessan/dcs,lamby/dcs,jamessan/dcs