Because they would have to pay billions for not delivering the gas due to the breach of contracts. Legally, you cannot turn off the taps just because.
Moreover, Russia can still supply very significant quantities of gas via Belarus and Ukraine, so they retain the leverage to blackmail the EU.