Dear Student ,
When you are performing an experiment to study the Ohm's law just keep the temperature of the circuit constant by keeping the key open after taking an experiment .
Now why one have to keep the temperature constant .
Look if the temperature does not remain constant then the resistance of the circuit will change and readings will change and the experiment result will come different than expected result .
So always try to keep the switch open when you are not taking reading and so no current flows through the circuit and Joule's heating will not occur here .
Regards