Bug: The writeStatistics method could crash out with NPEs

Twofold fix: catch "Exception" after each write, so a bug in one writer
doesn't mean we stop writing everything else. Also much more careful
handling of map values.

This is a side-effect, I suspect, of moving from the Trove Int2IntMap
class to a standard Java map.