He is dreaming.
So I've watched this a few times and read that you have to LISTEN to the ending if you want to know if he is still dreaming or not.
When the movie starts, his kids are playing IN THE SAND.
At the end when he sees them, they are playing IN THE GRASS.
He asks them what they are doing, they quietly reply:
"WE'RE BUILDING SAND CASTLES"
But they are not in sand, they are in grass, and wearing the same clothes as in his dreams.
Then the movie cuts off.
He is still dreaming.
