Working one at a time, brush edges of pastry with egg. Spoon a heaping tablespoonful of potato mixture onto center of each square. Fold pastry in half by bringing one of the top corners up and over filling and matching it up with the opposite bottom corner to make a triangle. Pinch edges together to seal, then crimp with a fork. Brush tops with egg and bake until pastry is golden brown, and cheese is melted, 25–30 minutes.