If it is still swinging open on its own repeat this process with the bottom hinge.
How to get a closet door back on its hinge.
Set two or three cardboard shims in the hinge mortises on the door and jamb then replace the hinge.
If a door binds open it grasp the knob and lift up to see if a hinge is loose.
Hold door hinge against cardboard and use utility knife to cut around hinge.
Release the door and let it swing gently back to the vertical position.
If one is loose remove two or more screws and try driving in longer screws.
Remove the shim and test the door.
Lay the door on a flat surface and unscrew the hinges from the door.
The style shown in the photo requires you to lift the door and drop the pin into a different notch in the bracket.
On the latch side a door is cut at a slight bevel to make it easier to close.
One requires you to loosen a set screw and slide the bracket in or out.
Unscrew the screws holding the bottom hinge to the door frame using a phillips screwdriver.
Open the door to carefully remove it.
Unscrew the top hinge from the frame.
Pushing the door upward into the top track gives the door enough space to fit into the bottom track.
Adjust the height of the doors by screwing the bottom pin in to lower them or out to raise them.
Spring loaded hinges are always spread out like a butterfly and mounted flat on the outer frame.
Reinsert the pin tapping it gently into place from the top with your hammer.
Insert the door s wheels into the double track inside the upper door jamb lifting it as far as it will go.