Bacon Wrapped Crab Stuffed Mushrooms


25-30 button mushrooms (mine were on the smaller side)
1/2 small onion (about 1/3 cup), finely chopped
2 cloves garlic, minced
salt and pepper to taste
6 ounces (188g, 3/4 of a package) cream cheese, softened
1 egg yolk, lightly beaten
1/2 cup parmesan cheese, shredded
1 can crab meat, drained
1 package bacon, pieces cut in half (optional)