The keets can start flying at around four weeks but not get really good at it until eight. You should keep new keets in pen for at least six weeks so they will learn where home is otherwise they will go wild and start roosting in nearby trees. This is when they become venerable to predators especially Owls who love snatching them off the roost.
I raise several hundred keets every year to sell and have learned to start letting them out at six weeks but make sure you heard them back in before dusk or they want to roost in trees. If they start getting into the trees throw a stick their way or my favorite is a childs BB gun, they do not like getting popped in the butt. The BB gun does not hurt them as long as you keep your distance (if they are close just get a stick) and you make sure you do not hit them in the head. Their feathers are so thick at this age the BB's wont hurt them.
Once you get them into a regular routine of going back into the pen at night they will do it automatically and all you have to do is close the door.