added defer for closing file

Merged Vivek Naik requested to merge defer_file_close into devbranch

added defer for closing file

Merge request reports