Fix concerning close delay potentially affecting the wrong alert dialog.