Cage doors are designed and built to be neutral, i.e. they would not open or close on their own. If they do, it is likely the floor or part of the cage is on a rug, etc.
Our Amazon is a very special guy! I say that because, after being part of our home for about two months, he simply dis-assembled the cage. After the third time, we simply began leaving his cage door open. More times than not, we will find him in his cage.
Placement of perches and their diameter is alway important. Our Amazon can be found on the one's he is comfortable on!
Yes, one has to make one's home Parrot safe!!
If your cage door is always closing, consider placing a thin rug under the side that locks.