[Fixes #83132470] Model store should reset fully with a new document.
Corrections from code review.

Make idCount and store array member variables. Remove the broken closure. Fix warnings.