close window after authentication