Puff pastry puffs because of little pockets of gas form between very thin sheets of lean dough. In handmade (and better-quality commercial) puff pastry, these gas pockets are filled with steam, which forms when the butter (which is about 16% water) heats up. In a typical commercial puff, the pockets are filled with c02 released from a chemical leavener like baking powder. For this structure to be stable, some internal rigidity needs to form before it cools; that rigidity comes from the sheets of lean dough being cooked enough to become crispy. If you open the oven before this happens, or take your dish out too soon, the thin sheets of lean dough won't have had a chance to crisp up enough to hold their shape, the gas inside the pockets will contract, the pastry will collapse, and you'll be left with a greasy, gummy mess. Short answer? Make sure it's fully cooked before you take it out.
More specific advice:
- Make sure that you don't open the oven during cooking, and make sure that you don't take it out too soon. If you have a window on your oven, try gauging the doneness before opening the door. If it looks like it's going to be far too brown for your taste by the time it's cooked inside, turn the oven off and let it sit in the hot-ish oven to crisp up a little without getting blasted by heat.
- If you haven't tested your oven's temperature, get an oven thermometer to make sure that you're at the temperature you think you are. Internal oven thermostats are notoriously inaccurate.
As an aside, you CAN overdo it when rolling out commercial puff, but if it puffed up in the oven initially and didn't collapse until you took it out, you can rest assured that this wasn't the problem.