Added assertions to check conditions for exiting while loop

in _raisePermanenceToThreshold method

fixes #1322 
As before, perhaps add a sentence such as: "This error is likely due to a value of stimulusThreshold that is too large relative to the input size.".