[bugfix] Make sure to close input/output streams in interleaving
order
[refaactor] Simplify by taking a WRITE lock immediately as we will be updating
anyway
[refactor] Simplify by taking a WRITE lock immediately if the copy/move src and
dest collections are the same
Experiment to use Java's ReentrantReadWriteLock instead of eXist's