Merge "Add else branch to avoide fclose(NULL)"