why do sodium channels close with excessive extracellular potassium ions in cardiac myocytes?
Short Answer

Depolarization block keeps sodium channels in a different state where they aren't available to open.

Longer Answer

The answer here applies equally to cardiac myocytes and neurons, and has to do with the gating properties of sodium channels (calcium channels have some similar behavior, which is also important).

Voltage-gated sodium channels at rest are pretty much all in a 'closed' state. The probability of a channel switching to an 'open' state increases with increasing voltage. However, those channels don't simply stay open indefinitely: they transition to third, 'inactivated' state. 'Inactivated' channels can't reopen. This helps keep sodium-mediated excitation brief and saves a lot of metabolic energy versus 'forcing' a cell to repolarize by only overwhelming the sodium conductance with potassium conductance.

Channels will stay in the inactivated state if the membrane remains depolarized. The probability of a channel switching from 'inactivated' to 'closed' (and therefore 'ready to open') increases with decreasing voltage. If a cell does not repolarize sufficiently, many sodium channels will stay in the 'inactivated' state. Further, channels that do switch to the 'closed' state could open, but not in synchrony. The eventual result is an equilibrium with a mix of sodium channels in open, closed, and inactivated states. There aren't enough 'closed' channels around to switch to open, there aren't enough 'open' channels to depolarize the membrane more, and as 'inactivated' channels switch to 'closed' there are other channels switching from 'open' to 'inactivated'.

This whole condition is referred to as 'depolarization block.'

Here's a helpful review on voltage-gated sodium channels that contains information covering what I discussed in my answer:

Catterall, W. A. (2000). From ionic currents to molecular mechanisms: the structure and function of voltage-gated sodium channels. Neuron, 26(1), 13-25.

You can also find lots more information in textbooks and elsewhere if you look for the term 'depolarization block.' Note also that I have simplified the gating transitions for voltage-gated sodium channels for the purpose of this answer, so some sources might explain a more complicated system; the general principles still apply to the question, though.