Move copychunk locking to be local to the read/write calls.