Yes. Once Gai opens the 8th gate Obito can simply retreat and wait till gai dies from opening the 8th gate.