A refrigerator is a heat pump. It takes heat from a cold reservoir (inside the refrigerator) and releases it to a hot reservoir (the room). The process requires work (electrical energy). By the first law of thermodynamics, the heat released into the hot reservoir is equal to the heat taken from the cold reservoir plus the work done. If the doors are left open, the refrigerator attempts to cool the entire room, but the net effect is that the heat dissipated by the compressor into the room is greater than the heat absorbed from the now open compartment, leading to a net increase in room temperature.