If accounting periods contain months with the wrong end date, you can use the script below to adjust the date. In the example below February was initially set to end on the 28th on a leap year and needed to be changed to the 29th.
update p
set End_Date = DATEADD(DAY,1,End_Date)
from GL_Accounting_Period p
where End_Date in(2024-02-28)