Added assertions to check conditions for exiting while loop

in _raisePermanenceToThreshold method

fixes #1322 
Since this error is likely to result from upstream user error, it would be good to make the text a little more self-explanatory. Perhaps add a sentence such as: "This is likely due to a value of stimulusThreshold that is too large relative to the input size.".