only fclose(f) a file once, to avoid a crash on Linux