Fixes an issue for negative BrickElement lock count

There were an issue with the if-statements in
BrickElement#getAndMarkWindow() where the brick wasn't always locked,
although it should have been every time before a persistence row was
created over a record, and yet it was always unlocked after use. This
resulted in negative lockCount on BrickElement. Funny how that didn't
cause problems, such as indefinite wait in allocateNewWindow which
contains a loop that awaits lockCount == 0.

Added an assertion for lockCount being equal to or greater than 0. There
are already some tests that failed by just adding that assertion and not
fix the lock counting issue. That's why this commit has no explicit tests
for the issue.