May one open or close the door of his fridge if the light was left active?
No. It is forbidden to open or close the door of the fridge if the fridge light was left active and will inevitably turn on or off upon being opened or closed. This applies even if all one’s Shabbos food is in the fridge. Thus, if one opened the fridge and then realized the light was left on, it is forbidden to close it.
A gentile: It is permitted to ask a gentile to open the door of the fridge even if the fridge light was left active and will inevitably turn on upon being opened. This applies even if one will benefit from the light being turned on. This applies even if one can make do without opening the fridge and the matter is not a great need. Some write that it is best not to tell the gentile about the light, and rather to simply ask him to open it. It is likewise permitted to ask the gentile to close the door. In order to be able to open the fridge the remainder of Shabbos without needing to ask the gentile each time to open and close it one can either: a) One may hint to the gentile to remove or deactivate the lightbulb. Some rule one may even ask him directly, if one needs to continuously open and close the fridge for the sake of one’s Shabbos food. or b) One is to leave the fridge door slightly open, and thus leave the light constantly on.
A child: It is forbidden to ask a child to open the fridge even if the child is beneath the age of Chinuch and even if he is a mere infant. Some however are lenient to permit to tell the child to remove the plug from the outlet while the fridge is off. This however only applies to old fridges which do not have any electricity working in the fridge when the motor is off. It is permitted to place a child that is below the age of Chinuch [less than 3 years old] in front of the door of the fridge [without telling him to open it], and if the child opens it on his own accord one may leave the fridge slightly ajar throughout the remainder of Shabbos.
 Igros Moshe 2/68; Beir Moshe Electri 6/9
 Igros Moshe 2/68; Beir Moshe Electri 6/9-10; SSH”K 31/1; Piskeiy Teshuvos 276/15
The reason: As it is permitted to ask a gentile to perform a Pesik Resihei. [Admur 253/10; 259/7; 277/5]
Other opinions: Some Poskim question the basis of the validity of this Heter from as perhaps in truth this is not considered a Pesik Reshei after all but rather a direct act. A Pesik Reishei is when one does an action that unintentionally causes an unrelated second action to occure. If however one does an action that has dual functions, one of Issur and one of Heter, then one cannot consider it a Pesik Resihei when doing the action for the purpose of the permitted function if it will inevitably perform also its forbidden function. This is similar to the switch of a water machine that accomplishes two things when turned on: 1) Turns on the light and 2) Opens the faucet. If one turns on the switch with intent to open the faucet and thus causes the light to turn on, this is not considered a Pesik Reishei but a direct act, being the purpose of the switch is also to turn on the light. [Rav SZ”A in SSH”K ibid and Shulchan Shlomo]
 Tehila Ledavid 336/4 based on M”A 253/41 and Admur 253/28 that allows the gentile to place the food near the heater and then turn on the heater; SSH”K 31/1 footnote 1; Poskim in Piskeiy Teshuvos 276/15 footnote 114
Other opinions: According to the Gr”a one is to be stringent if it is Nicha Lei. [Gra 253; brought in Shaar Hatziyon 253/4; Piskeiy Teshuvos ibid; See SSH”K ibid]
 Igros Moshe ibid
 Beir Moshe ibid; See LAOS Rav SZ”A ibid
 SSH”K ibid
 Beir Moshe ibid; SSH”K ibid
 Igros Moshe ibid as it is permitted to ask a gentile to do a Melacha in a time of great need.
 Beir Moshe ibid
 Admur 343/5; 265/10; Ketzos Hashulchan 147/3; Beir Moshe ibid
 Beir Moshe ibid
 Admur 340/10; Vetzaruch Iyun from 266/10, and so rules Ketzos Hashulchan 147 footnote 11, that a child even below Chinuch may only be given an object if the adult has no intent for the child to the prohibition with that object, while here the entire intent of lifting the child is for him to turn off the light. Hence on what bases is it permitted? Perhaps however one can say that since here one is not placing the item into the hands of the child and is simply placing him near the item, therefore it is more lenient.