It may be controversial but you don’t have to keep them boxed up at all. Certainly I’d say that there’s much more danger in closing them in than letting them come and go.
Make them want to stay, that’s what they want anyway. They don’t want to go back to the old hive location.
If you have a used box with drawn comb or better yet, open brood, they are likely to stay put.