Fix race between incremental updates and header checkpointing

The header checkpoints can not happen concurrently with incremental
updates, otherwise we can get a corrupted index file.

This can make headers be partially overwritten by the external processes
(couchstore does not open its files with O_APPEND) or have a wrong
padding/positioning as the view group/couch_file process is not aware
of the real current eof of the file

Change-Id: I8c0c98084f67075bb082d53d4457a11d9c7fb0b9
Reviewed-on: http://review.couchbase.org/33488
Tested-by: buildbot <build@couchbase.com>
Reviewed-by: Sarath Lakshman <sarath@couchbase.com>
Tested-by: Filipe David Borba Manana <fdmanana@gmail.com>