Heat the oil in a frying pan and add the onion and garlic. Drain the spinach and add to the pan. Season with salt, pepper, and nutmeg. Remove from heat.
Put the contents of the pan into a mixing bowl and add the cream cheese, milk, ham, and half of the mozzarella.
Roll the puff pastry dough out and divide into six equal portions.
Place about two heaping tablespoons of spinach mixture in the middle of each puff pastry square. Roll the corners of the dough to the middle and pinch each side together so that the filling is contained on all sides.
Brush each square with egg and sprinkle the middle with mozzarella. Bake at 375°F for 20 minutes.