Fix oauth page not closing