Added the fclose() for the input files.