Pear, Fennel, Red Onion, and Butternut Squash Gratin