Fixes a race condition in PersistenceWindowPool

There exists a race between refreshBricks() and writing out a PersistenceRow
 that has pending changes, when the latter is mapped over a position that
 refreshBricks() is going to map a persistence window underneath. This
 may lead to an older version of the data being written out over a
 later change.
This fix introduces a counter of persistence rows open over a brick
 which is waited for to reach to zero before a window is mapped over
 the same position. There is a double check happening before the lock
 is acquired and reduction of the counter does not happen under the
 brick lock.
Performance testing shows that this scheme does not affect performance
 in any significant way.
Remove sleep in busy wait in refreshBricks()

Operations in PWP are very fast, making any sleep potentially wasteful.
 Instead do a busy wait.
Merge pull request #1119 from digitalstain/pwp-race-fix

Fixes a race condition in PersistenceWindowPool