Due to https://bugzilla.wikimedia.org/show_bug.cgi?id=67488 the last five days of statistics are lost, this commit doesn't prevent this failure but by reversing the order of write we can avoid at least to lost statistics even if pywikibot is broken.