; (D) in the matter preceding subparagraph (A), as redesignated, in the first sentence, by striking Payment of and inserting (1) Except as provided in paragraph (2), payment of ; and (E) by adding at the end the following new paragraph (2): (2) Notwithstanding paragraph (1), the Secretary may, pursuant to such regulations as the Secretary shall prescribe, continue to pay allowances to eligible veterans and eligible persons enrolled in courses set forth in paragraph (1)(A)— (A) during periods when educational institutions are temporarily closed under an established policy based on an Executive order of the President or due to an emergency situation, except that the total number of weeks for which allowances may continue to be so payable in any 12-month period may not exceed four weeks; or (B) solely for the purpose of awarding a monthly housing stipend described in section 3313 of this title, during periods following a permanent closure of an educational institution, or following the disapproval of a course of study described in section 3699(b)(1)(B) of this title, except that payment of such a stipend may only be continued until the earlier of— (i) the date of the end of the term, quarter, or semester during which the closure or disapproval occurred