what if russianinvades them before they join nato?
As
@Freddie1980 says it seems unlikely that Russia has the logistic capability to launch an invasion of Finland whilst engaged in Ukraine. That wouldn't stop it lobbing some missiles and shells across the border, taking out a few military targets in airstrikes, or generally being a dick towards Finland. I don't see it though. Finland would be entirely justified in a highly aggressive response to such action, and while Finland is far from a military power it still has enough modern kit to irritate Russia, and the international response would be furious.
Economic action seems more likely, and while 100% of Finland's gas come from Russia it represents a small enough customer for Russia that cutting them off wouldn't hurt Russia much. Finland doesn't have any gas storage, so it wouldn't have time to implement a response before the impact was felt either. Still, gas makes up a relatively small part of Finland's energy production so it'd probably be okay.
They've tried that before. It didn't go well.
Russia suffered heavy losses in the Winter War, but they also walked away with roughly 10% of Finnish territories.