Yes, it was arranged it prior to his leaving office, but it was held up by Reagan's supporters so the handover would take place after the election..Remember his disastrous attempt to free tne American hostages, if successful he might have been re elected instead of Reagan
The hostages were freed a few minutes after Reagan took the oath.
Nobody seriously believes that Reagan arranged the deal within minutes. It was Carter's deal.