In medium skillet, melt butter over medium heat. Add onion and garlic; cook and stir for 4 minutes. Add apple, salt, and pepper; cook and stir until ingredients are tender. Add thyme and wine; cook and stir until liquid evaporates. Set aside. Unroll pastry and roll on lightly floured surface to a 13-1/2" square. Cut into two rectangles. Spread half of the onion mixture down the center of each rectangle and top with the tenderloin. Brush edges with the egg wash and bring together; press to seal. Place bundles seam side down on Silpat lined cookie sheet with sides. Brush with remaining egg wash. Bake for 30-35 minutes or until pastry is golden brown and meat thermometer inserted into pork reads 150 degrees F. Let stand for 10-15 minutes, then slice and serve.