Error #47 Substring reference out of string AR period end for May

SOLVED

Hello,

We've been trying to close AR for May and are receiving this error every time in 'Program' AR_PERIODENDPROCESSING_UI, Line 631. Any help, I've seen similar issues trying to research a solution but all are for different modules such as inventory. One solution from BigLouie is to : Make sure there are no cash receipts in progress. (We do not checked this)
Rebuild the keys for AR1
Rebuild the sort files.

However I am not sure if this solution would apply to me. I have attached some screenshots. Any help would be appreciated. Thank you!