fix popup not closing