Homestyx hydra

R1:368d2d1ddb11

Improve robustness of cluster version bookkeeping

Summary:
Ref T4292. Small fixes:

- There was a bug with the //first// write, where we'd write 1 but expect 0. Fix this.
- Narrow the window where we hold the `isWriting` lock: we don't need to wait for the client to finish.
- Release the lock even if something throws.
- Use a more useful variable name.

Test Plan:
- Made new writes to a fresh cluster repository.
- Made sequential writes.
- Made concurrent writes.
- Made good writes and bad…
Repository: R1 hydra
Commit Date: Apr 18 2016