Heat the butter in a saute pan and cook the onions over medium-low heat for 5 to 7 minutes, until tender. Add the garlic and cook for 1 more minute. Meanwhile, squeeze most of the water out of the spinach and place it in a bowl. Add the onion mixture, scallions, Gruyere, Parmesan, eggs, bread crumbs, salt, pepper, nutmeg, and pignolis. Mix well.
Unfold one sheet of puff pastry and place it on a baking sheet lined with parchment paper. Spread the spinach mixture in the middle of the pastry, leaving a 1-inch border. Brush the border with the egg wash. Roll out the second piece of puff pastry on a floured board until it's an inch larger in each direction. Place the second sheet of pastry over the spinach and seal the edges, crimping them with a fork. Brush the top with egg wash but don't let it drip down the sides or the pastry won't rise. Make three small slits in the pastry, sprinkle with salt and pepper, and bake for 30 to 40 minutes, until the pastry is lightly browned. Transfer to a cutting board and serve hot.