There is close button by default. You can disable it:
hermitage.closeButton.enabled = false
Now you can close the viewer only by clicking on empty space.