Before leaving Madinah
Try to perform one’s final two rak`aats in the Rawdah. Thereafter, offer one’s farewell Salaam to the Prophet (P.B.U.H.). Thereafter, engage in Du’a. One should also spend time reflecting on one’s actions when returning home. This is so that if one can remember any wrong or inappropriate action one can repent to Allah over it. As one is still a traveler until one returns home, and that the traveler’s supplications are accepted, one should supplicate for one’s own forgiveness and also for the forgiveness for the Ummah in general over and over again.