Fixing bug where Login Window was not closing in Cordova if the token was received too fast