This happens when the pie hasn't been baked for long enough or the apple chunks are too large. This is why for this recipe the apples need to be grated instead of chopped.