fix WMStats reader when document is deleted between calls
Merge pull request #5185 from ticoann/wmstats_fix

fix WMStats reader when document is deleted between calls