Use with for file handling avoiding need to manually close open files and catch situations where files were also not being closed. Change-Id: I942c97ce93e4a4311f7d0ab8cd748ea04ef7babb