Empty your closet completely. Clean the space out with a vacuum and broom.
If there are any spots that need to be washed with soap and water, you should do so, and allow the area to dry out completely before completing the project. You do not want to leave anything in that will rot or decay overtime, because you will not be able to get it back out.
Remove the door from the frame, and remove the door frame from the wall. This means you should remove the trim, and the hardware surrounding the door.
A crowbar will help you pry it off the walls. Be careful not to damage any drywall around the area, because you will need to replace any damaged sections.
Measure the hole in the wall you will need to replace. Cut the wood to build a frame to slide in the doorway.
Measure width of the doorway, and then measure from the floor to the top of the of the door frame. Subtract 4 inches from this measurement to find the height of your studs for the frame.
Cut the 2-by-4s for the frame using the circular saw. You will need two pieces the length of the frame you are building, and enough stud pieces that you can space them 16 inches apart and at each end of the frame.
Build the frame by nailing the corner pieces of the frame together. You should use two nails for each side of the studs.
The 4 inch side will lie flat against the ceiling and the floor. Make sure the frame is square and then nail the studs into place 16 inches apart across the length of the frame.
Nail the frame into place. First nail it into the floor, and then the ceiling on each side of each stud.
Then nail up along each side every 18 inches to secure the frame in place.
Hang the drywall with drywall screws. If possible just use one piece of drywall, but if you are closing in a closet with bi-fold doors, you will need more than one piece.
Seal the seams of the drywall with the drywall tape, and then cover that and the screws with drywall cement. Allow it to dry completely and then sand it smooth.
Paint the entire wall. You may want to start with a primer on just the drywall and then add several coats to the entire wall to get an even color.
Nail the baseboards in place over the section of the wall you filled in.