To ensure that your meringue does not shrink while cooking, make sure to spread it over the top of the pie with an offset spatula.  Additionally, try brushing a bit of melted butter on the meringue before baking. This will help keep the meringue in place and prevent it from shrinking while cooking.