And know that in the Yerushalmi, Kirah (halacha 7), it is stated: "A lamp that is placed behind the door—one may open and close it on Shabbat, provided that he does not intend to extinguish nor to kindle. Rav and Shmuel interpret this as referring to one who forgets, and they curse whoever does so: 'May Hashem cut off the man who does this, etc.' (Malachi 2:12)" Thus far its words. And this is its explanation: one opens and closes gently, provided that he does not intend to extinguish nor to kindle, meaning that he does not intend to distance the oil or bring it closer; and naturally, when he opens and closes in his usual manner, it is a pesik reisha as in our Talmud. And Rav and Shmuel said that even this is in a case of one who forgets, for it is necessary to permit opening and closing gently. But in the case of one who initially places a lamp behind the door and kindles it on Shabbat—they curse him, because it is close to coming to a Torah prohibition. And according to this, we have learned from the Yerushalmi that when a person has a fixed lamp behind the door, he should not kindle it initially for Shabbat. (And it is necessary to explain it thus, for behold Rav and Shmuel say so, and in our Shas 120b, "Rav cursed regarding it," and perforce the intention is to opening and closing gently. And that which the Korban HaEdah explained, that by placing it, it becomes a basis ledavar ha'asur, see there—it is against the words of the Tosafot there, and it is clear as I have written. And the Taz, subsection 2, wrote that according to this explanation it does not avail to open and close gently, see there, and this is against the words of the Rambam that we brought. And it is clear that gently it is permitted, and so wrote the Bach, see there; and also that which was written in the Shulchan Aruch according to the explanation of our teacher Chananel that even closing is forbidden—the Bach and the Magen Avraham, subsection 4, have already questioned him, and the Taz, subsection 1, labored to settle it with forced words, see there and examine carefully.)
ודע דבירושלמי כירה (הלכה ז') איתא: "נר שהוא מונח אחורי הדלת - פותח ונועל בשבת, ובלבד שלא יתכוין לא לכבות ולא להבעיר. רב ושמואל פתרין ליה בשוכח, ומקללין מאן דעביד כן: "יכרת ד' לאיש אשר יעשנה וכו'" (מלאכי ב יב) עכ"ל. והכי פירושו: פותח ונועל בנחת, ובלבד שלא יתכוין לא לכבות ולא להבעיר, כלומר שלא יכוין להרחיק השמן או לקרבו, וממילא דכשיפתח וינעול כדרכו - הוי פסיק רישא כבתלמודא דידן. ואמרו רב ושמואל דגם זה הוא בשוכח, דבהכרח להתיר לפתוח ולנעול בנחת. אבל במניח לכתחלה נר אחורי הדלת ומדליקו בשבת - מקללים אותו, מפני שקרוב לבא לידי איסור דאורייתא. ולפי זה למדנו מירושלמי דכשיש לאדם נר קבוע אחורי הדלת - לא ידליקנו לכתח(י)לה על שבת. (ובהכרח לפרש כן, שהרי רב ושמואל אומרים כן, ובש"ס שלנו ק"ך:, 'לייט עלה רב', ובעל כורחנו דהכוונה לפתוח ולנעול בנחת. ומה שפירש הק"ע דבמניח נעשה בסיס לדבר האסור ע"ש - היא נגד דברי התוספות שם, וברור היא כמ"ש. והט"ז סק"ב כתב דלפירוש זה לא מהני לפתוח ולנעול בנחת ע"ש, וזהו נגד דברי הרמב"ם שהבאנו. וברור היא דבנחת מותר, וכן כתב הב"ח ע"ש, וגם מ"ש בש"ע לפירוש רבינו חננאל דגם נעילה אסור - כבר השיגו עליו הב"ח והמג"א סק"ד, והט"ז סק"א טרח לתרצו בדברים דחוקים ע"ש ודו"ק)