Corrected CT::Record locking bugs and added a handy write lock method.

* CT::Record#write_locked? and CT::Record#read_locked? had backwards constants
* Implemented CT::Record#with_write_lock! method