Hope you are doing well.
Unfortunately to process for May you will have to delete the salary period of June.
A Salary period once closed in order to make changes/add new entries you will have to open the same salary period again. As per your situation as long as June Period is open you will not be able to open May.
In order for you to process salary for May you have the delete the entire payroll work you did for June and then process for May. After which you can redo June again.
I understand this is not the solution you were looking for. But there is no alternative solution for this issue.