added close file to main method.