Well, I've solved it myself.
I put it here in case someone serves.

What it does when starting the emulator N64 is to restart the GPIO of the Raspberry Pi and the pins that are configured as output PWM are put to full power.

What I have done to solve it is to insert the following command:

Gpio -g mode 18 pwm

I put it inside the infinite loop that checks the temperature.

I hope that it would be useful to someone.