If your closet is smelling musty make sure your closet isn't too full of clothing so it allows some airspace to prevent mold and musty odors.
Next remove the clothing and everything in your closet and scrub the closet down with vinegar and water and if your closet has carpet scrub the carpet down as well with vinegar and water in a carpet cleaner.
Then place an open container of baking soda in the closet which will help absorb odors or use an automatic air freshener that will release the air freshener automatically at set times.