the gas cap is vented, there is no "pressure" involved, the gas could siphon regardless .... you could open the line at the sender, or you could have everything ready, including a pan to catch the gas, remove and replace the filter as quick as you can, not likely to get more than a cup or so out if you're not too fumble fingered

if there's a long enough rubber line before the filter you could also clamp it there while you work
Bill