Error -25204 is kAXErrorCannotComplete “The function cannot complete because messaging failed in some way or because the application with which the function is communicating is busy or unresponsive”. The log goes on to say “failed to find button”. So I would guess the process of enumerating the elements of that window is failing at some point and not finding (or pushing) the Quit button.
I’d suggest you use Click at Found Image instead.