Has macOS recently changed how it handles popup windows that open, print and close?

I’d implented a pop up window to print some javascript generated content, using code based on this old question.

The key bit of the code is

var mywindow = window.open('', 'PRINT', 'height=800,width=800');
mywindow.focus(); 
mywindow.print();
mywindow.close();

This was working, but I’ve just been given bug reports that it has stopped working on macOS, on both desktop Safari and Chrome. I can’t replicate the issue on a PC, so I assume it is an Apple-specific issue. I don’t have a desktop Mac to test on.

If you remove the mywindow.close(); then I’m told it works, but you have to close the window manually.

Is there a specific update which has stopped this working? If so, what are the limitations it has added?