How to use bones to fold a model like cardboard?
If you select the armature, then the box, and switch to Weight Paint mode, you can see what is the influence of each bone. In your case you can see that it's not correct. For example the bone on the left has an influence on the whole box while I guess the top is supposed to be controlled by other bones. Same thing for the top bones, if I move one, it deforms much more that what is supposed to deform, even some parts that appear blue, but must have an influence superior to 0.

I think maybe you counted on the Automatic Weights mode when you parented, but for this kind of rigging (i.e. not organic object) you should have used the With Empty Groups method:

So first delete all existing groups (or in your case, unparent your box with altP, it will keep the vertex groups and you won't have to parent with empty groups).

Once you've parented With Empty Groups, your mesh has as many vertex groups than you have bones, but they have not been assigned to any vertex yet. You just need to select your object, go in Edit mode, go to the Properties panel > Object Data > Vertex Groups, select a group in the list, then in the 3D view select the vertices that are supposed to be part of this group, meaning which are supposed to be influenced by the bone with the same name, and press the Assign button under the vertex groups list.