arduino nano freezes

Hello!
I have one problem. Arduino nano sometimes freezes me, randomly. I have a temperature and humidity controller. cooler, heater, humidifier, dehumidifier. control with relays 220v. nokia 5110 lcd. I’m adding the code. The problem is if it freezes when the relay is switched on, for example, heats. then it does not turn off and heats up until I reset the arduino. which is not good. thanks for the answers

susenje_mesa_10.1.19.ino (20.3 KB)