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 turning on. This applies even if one can make do without opening the fridge and the matter is not a great need. Some Poskim 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 light bulb. Some Poskim rule one may even ask him directly to remove the bulb, if one needs to continuously open and close the fridge for the sake of one’s Shabbos food. According to Admur however, it is forbidden to tell him directly to remove it. or b) One is to leave the fridge door slightly open through placing a towel and the like in-between, 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 Poskim however permit telling 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 when the motor is off. It is however 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 Reishei. [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 occur. If, however one does an action that has dual functions, one of Issur and one of Heter, then one cannot consider it a Pesik Reishei 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 who 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 Rav SZ”A ibid
 SSH”K ibid
 Beir Moshe ibid; SSH”K ibid; See Admur 307/7
 Igros Moshe ibid
 The reason: As it is permitted to ask a gentile to perform a Melacha in a time of great need. [Igros Moshe ibid; Opinion in Rama 276/2 and in Admur 276/8; 331/7; 340/2; 446/6]
 Final ruling of Admur 276/8; 331/7; 340/2; 446/6 in Hagah
 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 perform the prohibition with that object, while here the entire intent of bringing 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.