Add a flush function to each index type

Each RTree variant also needs to be able to flush its header to disk on
request so that we can successfully reopen indices.
Merge branch 'flush-index-headers'

For Cloudant deployment