Added assertions to check conditions for exiting while loop
in _raisePermanenceToThreshold method