Can you close the PWA programmatically?

Syam Pillai:

UI.getCurrent().getPage().executeJS("window.close();");

It should work when you are in Production mode.

How to toggle Production Mode when running using the IntelliJ Run Configuration (Application.java)?