Update the dirstate tests to lock and unlock properly.
Change the lock.WriteLock functions so that they open in 'rb+' mode instead
of automatically truncating the file.
test_dirstate.py now passes, but we need to figure out or locking mechanism for
WorkingTree4. (does it just lock at the same time as Tree.lock_write()?)