fopen and fclose to ppm_write_to_file function