They pay you a month behind for a specific reason. No matter when you die, you have to pay back that last month's payment to SS. If you die on June 31st, you still have to pay it back for all of June. But since they pay you a month behind, all they have to do is cancel the last payment.
It's easier than trying to squeeze blood from a turnip.
TIP: At some point, you will receive a letter that says at the very top:
"Social Security Administration
Retirement, Survivors and Disability Insurance" and they list what you're getting, how much you're getting, and when you're getting it, all on one page.
SAVE THIS DOCUMENT AND PUT IT IN A SAFE PLACE WHERE YOU CAN FIND IT. Someone, some time, will ask for it. Sometimes they call it by some really internal stupid name. But this is what they want.