While a candle is burning at home, one must be careful not to open a window or door facing it, as the wind may blow out the flame. Even if the wind outside is currently too weak to put out a candle, one still may not open a window, since it might happen that at the very moment when the window is opened, the wind will become stronger and blow out the candle. If this happens, it would mean that the act of opening the window blew out the candle. When there is no wind whatsoever, some permit opening the window, while others forbid it. In a case of necessity, such as when it is hot inside the room, one may follow the lenient position, and the window may be opened (MB 277:3).
One may open a window or door if even a strong wind would be unable to extinguish the candle; for example, if the candle is at a great distance from the window or door, or if the window is at such an angle that very little wind comes through it. Even if the wind is likely to affect the flame and cause it to flicker, as long as it is not powerful enough to blow it out, one may open the door or window (SA 277:1; Menuĥat Ahava 3:26 n. 6).
If Shabbat candles were lit in front of an open window and then the wind started blowing, the window may be closed in order to protect the flame. By closing the window, one is not acting directly on the flame itself; one is merely preventing the wind from blowing it out (Rema 277:1).
Similarly, one may close a door in a place where a fire is burning (such as a room with a fireplace), even if the wind coming in is blowing on the coals and fanning the flame, and closing the door will weaken the fire. Closing the door is not considered an act of extinguishing, since it merely prevents more wind from entering and feeding the flame (SA 277:2). In contrast, if the fire is fueled by gas or kerosene, one may not turn down the flow of the fuel. This truly qualifies as extinguishing, since one is acting directly on the fuel itself (SA 265:1).