He may have left so no one can see him cry. And his last words were "I want my mommy!"
In the Novelization, the scene is a little longer and that much sadder. It ends with Hook talking quietly with Peter's daughter through the cell door, acting rather more human than we've seen thus far.
Maggie: Don't you have a mother? Or anyone?
Hook: Child, I am the iron will keeping this ship together. I... have no time for such things.
The entire scene where Peter regains his memories, starting with, "I remember..."
"I wish I had a dad... like you."
Peter Banning: Tink! Tinkerbell: Say it, Peter. Say it and mean it. Peter Banning: I believe in fairies. Tinkerbell: You know that place between asleep and awake? That place where you still remember dreaming? ... That's where I'll always love you... Peter Pan. That's where I'll be waiting.
"Then I came back...the last time".
At the end when the children come back but their mother hasn't seen yet.
Wendy: My dear child, have you been up all night? Moira: I see them in their beds so often in my dreams. When I wake up, they're still there.
Peter telling the story of how he ran away. He was scared of being an adult, of all the commitments and, most importantly, death. Even though his mother was planning things out for him so that he would be successful and yet still could be a family man, he ran away. And when he came back, they had had another child, and put bars over the windows to keep him inside. Made even worse because the original book had a story where Peter lived in a park in London for a good portion of his life before going to Neverland, and that same thing happened in that story.
The remorseful look on Thud's face is heartbreaking.
Thud Butt: My happy thought will help you.
Peter: What's your happy thought, Thud?
Thud: Mine's my mother.
Several exchanges between Peter and other characters are especially poignant and tear-inducing after Robin Williams' death. To wit:
Peter: To die would be a great adventure
Hook: Death is the only adventure you have left.
At the end of the film
Wendy: So... your adventures are over.
Peter: No. To live... to live would be an awfully big adventure.