I'm not sure how to teach them not to run out the door, but I would definitely put up a baby gate until then as a precaution. They have these short 18-inch gates that we use so they're easy to step over and the dogs can't get over, but there's a door through them.
Four Paws Walk Over Wooden Gate for Small Pets at PETCO