Well it's Obito's eye so I imagine that he has capabilities of closing the Kamui dimension anytime it gets opened. So by Kakashi trying to send the Mazou's head to Kamui, Obito was able to negate it by closing the dimension gateway. Or something like that.