The Holy Prophet sent everybody out in his last moments and had confidential talk with Imam Ali. Please also check in Tarimdhi the Holy Prophet conducted secret and confidential talk with Imam Ali on one more occasion at the day of Taa,if.
Uma Salma (the wife of the Prophet) narrated:
Surely, it was Ali at the last with whom Prophet talked with.
Arabic text scanned page and urdu translation