In the interest of full disclosure, I want to acknowledge my bias against taking an early distribution from 401(k) and similar accounts. I feel this way for two reasons. First, you mentioned the 10% penalty tax. Second, the money in pre-tax retirement accounts was set aside for, well, retirement, and you may have other options for handling the debt.
Let us look at some numbers. Assuming you retire in 17 years, and make no additional contributions to the retirement account. With a 5% annual return, the $24,000 you have today will grow to $55,000 by the time you reach age 67. Now let me add one hypothetical fact. Let us assume you make a 4% annual contribution to this account. For most employees, a 4% contribution to a 401(k) or similar account is unnoticeable because the contribution is offset by the decrease in taxable income. In other words, the contribution is free money. With a 4% contribution and a 5% return, the miracle of compound interest yields a $107,000 account balance by the time you attend your retirement party. My question for you is, "Do you want $17,000 today or $107,000 at age 67?"
I dislike a home equity loan for a person nearing retirement age, so I want to take that option off of the table.
Regarding your debt, you do not mention the interest rate you are paying on your senior or junior mortgage. Regarding the junior, if you are paying in the 10% or higher range, then my objection to invading your retirement account softens. If you are paying a high interest rate on this loan, then consider receiving a distribution large enough to extinguish this debt plus the second credit card.
Alternatively, if your employer is requiring you to close this account, I strongly urge you to consider rollover.
I hope this information helps you Find. Learn & Save.