Russia is also the source of Ukraine’s gas. And the pipelines are the source of Ukraine’s income. So shutting them hurts Ukraine more than Russia.
Actually, Russia has in the past shut off the gas to Ukraine because of debt and because some of the gas transmitted to Europe disappears on its way through Ukraine. As a consequence Russia has been building pipelines that bypass Ukraine just to give it some alternatives.
Ukraine can shut down the gas in the far west and still maintain flow for use inside the country. Check the map.