[FIX] Core, Locking: Downgrades to no Write locks

When downgrading from a local write lock to no write locks, the local write
lock counter was not decremented, thus global read lock transactions would
fail.

Additionally contained:

- Added locking unit test
- Moved XQuery locking test to appropriate package
- Reenabled downgrades