The late Shaykh Tusi (r.a.) and Sayyid Ibne Tawoos (r.a.) has said that when you want to say farewell to the Imams (a) of Baqee, you must say:
Then supplicate as much as possible and beg Allah that He again blesses you with their Ziyarat and that it should not be your last Ziyarat and your last time.