Of course, if keeping accounts open and having credit available could trigger additional spending and debt, it might be more beneficial to close the accounts. Only you know all the ins and outs of your financial situation, and like thumbprints, they're different for each person. Make sure you carefully evaluate your situation; only you know what can work best for your financial outlook.
Credit scoring models usually take into account how much you owe compared to how much credit you have available, called your credit utilization rate or your balance-to-limit ratio. Basically it's the sum of all of your revolving debt (such as your credit card balances) divided by the total credit that is available to you (or the total of all your credit limits).