fix a bug where we always wait for the delay because we never refresh the value of alert
Merge pull request #1300 from dandover/waitForAlertToClose-bug

refresh the value of alert so we don't always delay