Tweaked ngram memory cleanup.