Updated conditions for displaying the close button in alert messages