Added missing fclose call