The pop up window has the following code to invoke print and it automatically closes the window once the print window closes.
<html>
<body onload="window.focus();window.print();window.close();">
The content to be printed
</body>
</html>
This code work just fine in most browsers; window.print() blocks the execution of window.close() until the print window is closed either by completing printing or cancelling it. However, the window.print() does not block the execution of window.close() in safari 10.0.1 in mac.
Is there any way to make it work on all the browsers?