Correct omitting the steps needed for both default and custom alert boxes in order for them to be closed. Addresses Issue #5414.