missing fclose when returning early