Printing JSON for improved parsability

While `pprint` pretty much outputs JSON I'd rather be sure it's fully
compliant.
Making sure to close the file

We all have our pet peeves ;-)