Rav Yosef taught: what is the meaning of what is written, "And none of you shall go out" (Exodus 12:22)? From here we learn that once permission has been given to the Destroyer, it no longer distinguishes between the righteous and the wicked. And not only that, but it begins with the righteous first, as it says, "And I will cut off from you the righteous and the wicked" (Ezekiel 21:8). When Rav Yosef reached this verse he would weep, saying: all this too [the righteous] are reckoned as nothing. Abaye said to him: it is a kindness toward them, as it is written, "For the righteous is taken away from before the evil" (Isaiah 57:1) - he is gathered in before the calamity comes. A person should always enter while it is good light, and so on. The Rabbis taught: if there is plague in the city, gather in your feet (stay home), as it says, "And none of you shall go out," and it says, "Come, my people, enter your chambers and shut your door behind you; hide yourself for a little moment until the wrath passes by" (Isaiah 26:20). And it says, "Outside the sword bereaves, and in the chambers, terror" (Deuteronomy 32:25). What does "and it says" add? Should you say these words apply only at night but not by day - come and learn: "Come, my people, enter your chambers." And should you say these words apply only where there is no terror within, but where there is terror within, going about among people in company is better - come and learn: "Outside the sword bereaves" - even though within the chambers there is terror, outside the sword bereaves.
When the Destroyer Is Loosed It Does Not Distinguish Righteous From Wicked
Yalkut Shimoni on Torah 206:4
תָּנִי רַב יוֹסֵף מַאי דִּכְתִיב וְאַתֶּם לֹא תֵצְאוּ. מִכָּאן כֵּיוָן שֶׁנִּתַּן רְשׁוּת לַמַּשְׁחִית שׁוּב אֵינוֹ מַבְחִין בֵּין צַדִּיק לְרָשָׁע, וְלֹא עוֹד אֶלָּא שֶׁמַּתְחִיל מִן הַצַּדִּיק תְּחִלָּה, שֶׁנֶּאֱמַר (יחזקאל כא, ח) "וְהִכְרַתִּי מִמֵּךְ צַדִּיק וְרָשָׁע". כִּי הֲוָה מָטֵי רַב יוֹסֵף לְהַאי קְרָא בָּכִי, כּוּלֵי הַאי נַמִי (לאוקמינהו) [לְאַיִן דּוֹמִין] אָמַר לֵיהּ אַבַּיֵּי, טִיבוּתָא הוּא לְגַבַּיְיהוּ, דִּכְתִיב (ישעיה נז, א) "כִּי מִפְּנֵי הָרָעָה נֶאֱסַף הַצַּדִּיק". לְעוֹלָם יִכָּנֵס אָדָם בְּכִי טוֹב וְכוּ'. תָּנוּ רַבָּנָן, דֶּבֶר בָּעִיר כַּנֵּס רַגְלֶיךָ, שֶׁנֶּאֱמַר וְאַתֶּם לֹא תֵצְאוּ וְגוֹ'. וְאוֹמֵר "לֵךְ עַמִּי בֹּא בַחֲדָרֶיךָ וּסְגֹר דְּלָתְךָ בַּעֲדֶךָ חֲבִי כִמְעַט רֶגַע עַד יַעֲבָר זָעַם". וְאוֹמֵר (דברים לב, כה) "מִחוּץ תְּשַׁכֶּל חֶרֶב וּמֵחֲדָרִים אֵימָה". מַאי וְאוֹמֵר, וְכִי תֵימָא, הַנֵי מִילֵי בְּלֵילְיָא אֲבָל בִּימָמָא לָא, תָּא שְׁמַע, לֵךְ עַמִּי בֹּא בַחֲדָרֶיךָ. וְכִי תֵימָא, הַנֵי מִילֵי דְּלֵיכָּא אֵימָה מִגַּוַּאי אֲבָל הֵיכָא דְּאִכָּא אֵימָה מִגַּוַּאי כִּי אָזִיל וַאֲתֵי בֵּינֵי אִנְשֵׁי בְּצַוְתָּא טְפֵי מַעֲלֵי, תָּא שְׁמַע, "מִחוּץ תְּשַׁכֶּל חֶרֶב", אַף עַל גַּב דְּמֵחֲדָרִים אֵימָה מִחוּץ תְּשַׁכֶּל חֶרֶב.