Spray the hinges on the insides of the closet doors with short bursts of lubricant, working the doors back and forth.
Clear the floor inside the closet of any obstacles, such as shoes, that may be blocking the doors from closing properly. Items behind the doors, especially where the doors are hinged together, may not be immediately noticeable.
Push down on the spring-loaded guide rod at the top of each door where the bifold door sections meet in the center of the closet. Pull the doors away from the closet so the guide rods are out of the track in the ceiling. Now you can lift the bifold doors out of the corners of the closet and set them aside to adjust the ceiling track.
Turn the screws in the upper left and right corners of the ceiling track counterclockwise to loosen the brackets. Slide each bracket back toward the wall on the left and right side, then tighten the screws.
Insert the steel pins on the tops and bottoms of the bifold doors into the holes at the top and bottom corners of the closet. Push down on the spring-loaded guide rod on the top of each door to guide it into the metal track, then release it. The guide rods pop up to hold the two inner doors in the track.
Push inward on the knobs of your bifold doors to close the doors together. If they still will not shut, you may have a bent hinge in one or both of the bifold doors. Unscrew the hinges and take them to a hardware store to match up with replacements.