In siman 132 it was explained that a person should not leave the beit knesset until after "Ashrei"-"U-va Le-Tzion," and behold, according to our custom, we return the Torah before "Ashrei"-"U-va Le-Tzion." However, the custom of Sefarad is to return the Torah to the aron on a day of Torah reading after the full Kaddish of "Ashrei"-"U-va Le-Tzion," and therefore it is forbidden for a person to leave the beit knesset until after they return the sefer Torah to the aron. And thus they said in Sotah (39b): The congregation is not permitted to leave until the sefer Torah is taken and placed in its location. And such is the wording of the poskim. Our teacher, the Rema, wrote: However, if not the congregation but only an individual leaves – we have no concern regarding it. Thus far his words. That is to say: one by one, provided that the majority do not leave (Magen Avraham, subsection 2). And I wonder greatly about this: for granted that there is one who says so (see Beit Yosef in the name of the Talmidei Rabbeinu Yonah), nevertheless, Rashi explicitly explained otherwise. This is the wording of Rashi there: And a person shall not leave through the entrance before the sefer Torah. Thus far his words. And from the Gemara itself there, throughout the entire sugya, it is explicitly proven that every single individual is included in the term "congregation," for we say there: The congregation is not permitted to answer "Amen" until the blessing is finished from the mouth of the Kohanim; the congregation is not permitted to answer "Amen" until the blessing is finished from the mouth of the reader, see there. And it refers to every single individual, and here too it is so. Therefore, it appears in my humble opinion that this prohibition applies to every individual. (And also the Tosafot of Rabbeinu Yonah only said this because people are not careful in this, see Beit Yosef. And none of the Rishonim said this. And our proof is compelling.)
בסימן קל"ב נתבאר שאין לאדם לצאת מבית הכנסת עד אחר "אשרי"-"ובא לציון", והנה לפי מנהגינו מכניסין התורה קודם "אשרי"-"ובא לציון". אבל מנהג ספרד להכניס התורה לארון ביום קריאת התורה אחר קדיש שלם של "אשרי"-"ובא לציון", ולכן אסור לאדם לצאת מבית הכנסת עד אחר שיחזירו הספר תורה להארון. וכך אמרו בסוטה (לט ב): אין הציבור רשאין לצאת עד שינטל ספר תורה ויניח במקומו. וכן הוא לשון הפוסקים. וכתב רבינו הרמ"א: מיהו אם אינם יוצאים רק יחיד – לית לן בה. עד כאן לשונו. כלומר: אחד אחד, ובלבד שלא יצאו רובן (מגן אברהם סעיף קטן ב'). ואני תמה מאוד על זה: דנהי דיש מי שאומר כן (עיין בית יוסף בשם תר"י), מכל מקום הא רש"י פירש להדיא לא כן. וזה לשון רש"י שם: ולא יצא האדם בפתח לפני ספר תורה. עד כאן לשונו. ומהגמרא עצמה שם בכל הסוגיא מוכח להדיא דכל יחיד ויחיד הוא בכלל "ציבור", שהרי אמרינן שם: אין הציבור רשאין לענות "אמן" עד שתכלה ברכה מפי הכהנים; אין הציבור רשאין לענות "אמן" עד שתכלה ברכה מפי הקורא, עיין שם. ועל כל יחיד ויחיד קאי, והכא נמי כן הוא. ולכן נראה לעניות דעתי דעל כל יחיד יש איסור זה. (וגם תוספות ר"י לא אמרו זה אלא מפני שאין נזהרים בזה, עיין בית יוסף. ושום אחד מהראשונים לא אמר זה. וראייתינו מכרחת.)