Some applications don't provide enough meta-data (attributes) to enable you to create a unique 'fingerprint' for an element. Ordinal can help, but only if it is consistent, and that depends on the way the app was programmed and isn't guaranteed. Same with Match Index, ie the Nth matching element. As long as you are certain that your button is always the 4th match, then it will work.
Maybe a workaround is to direct a mouse click to a nearby element that can be spied reliably, but use XY coordinates that will hit the close button and not the element. For example, in the screenshot there is a CVS Group PLC button, and let's assume it is 200 pixels wide. If you do a mouse click on it but with coordinates 220,5, the mouse will miss the CVS button and hit the X button.