Add fclose in extractFile and copyFile