Added support for lazy file parsing and improved closing of files
p4#: 20644