Added usage data queue flushing in several places

Refs #851 and #840
Clean-up the new code a bit
Revert "Attempt to fix missing usage data" and tiny improvement

This reverts commit 5a1a8f83b33e1dc509f10cbcf3e50bb86cc0dffa.
And corrects the timestamp calculation on some usage data.
Merge pull request #852 from jpeg729/usage_data

Added usage data queue flushing in several places