It seems that Jesus is suggesting that Judas had already died before he commits suicide, which we know happens after the betrayal.
For some context let me start the quotation from John 17:6.
“I have manifested Your name to the men whom You gave Me out of the world; they were Yours and You gave them to Me, and they have kept Your word. Now they have come to know that everything You have given Me is from You; for the words which You gave Me I have given to them; and they received them and truly understood that I came forth from You, and they believed that You sent Me. I ask on their behalf; I do not ask on behalf of the world, but of those whom You have given Me; for they are Yours; and all things that are Mine are Yours, and Yours are Mine; and I have been glorified in them. I am no longer in the world; and yet they themselves are in the world, and I come to You. Holy Father, keep them in Your name, the name which You have given Me, that they may be one even as We are. While I was with them, I was keeping them in Your name which You have given Me; and I guarded them and not one of them perished but the son of perdition, so that the Scripture would be fulfilled. John 17:6-12
In verse 12 (bold) Jesus says he was guarding his disciples except the son of perdition, and from John 13:26 and other passages it is clear that Jesus is referring to Judas.
From 18:1-2 it is clear that immediately following his prayer Judas was still in the act of betraying Jesus.
When Jesus had spoken these words, He went forth with His disciples over the ravine of the Kidron, where there was a garden, in which He entered with His disciples. Now Judas also, who was betraying Him, knew the place, for Jesus had often met there with His disciples. John 18:1-2
We know Judas feeling guilty of sin killed himself by hanging, and later his guts spilled on the ground.
And he threw the pieces of silver into the temple sanctuary and departed; and he went away and hanged himself. Matt 27:5
(Now this man acquired a field with the price of his wickedness, and falling headlong, he burst open in the middle and all his intestines gushed out. Acts 1:18
So why does Jesus refer to Judas as perishing before he had even finished betraying him with a kiss? There must be some way to harmonize the words of Jesus with the events of Judas' life. Maybe I'm just not aware of what that is.