A habitat on Mars would certainly not be closed ecosystem, especially not in the beginning. The biggest issue at biosphere IIRC was CO2 poisoning. You can crack the air in a mars habitat with power and in the worst case find Martian resources that will do some advantageous chemistries
This is pure speculation until it's demonstrated. Is SpaceX funding such demonstrations?