https://developer.apple.com/documentation/safariservices/saf...
More specifically, if you can inject scripts I don’t see why you couldn’t call window.close()
https://developer.apple.com/documentation/safariservices/saf...