Fixed issue which caused error to be thrown when file content ended with a } and other characters