Should I frame a closet prior to putting in hardwood flooring?
Walls first, then floor.  Otherwise, if you ever need to remove the floor, you'll be forced to leave some of it in place to hold up your walls (or take the closet out as well).