Use Context Manager for reading JSON configs

Avoids leaking a fd when there's an exception.

Change-Id: Iacd10edc58037192a2e710c47a6caf0da40c6d71
Merge "Use Context Manager for reading JSON configs"