It is possible to force the termination of a virtual desktop session, it’s also possible to show an extra dialog to the user when they click X to close the window.
# Set for how long the server has to keep alive virtual desktops in
# status disconnected. When the time is expired, the server will
# terminate virtual desktops if no user are connected there.
#
# 0: Virtual desktops in status disconnected are never terminated.
# This is the default.
#
# >0: Keep alive virtual desktops in status disconnected for this
# amount of seconds.
#
#DisconnectedSessionExpiry = “0”
To activate the dialog I mentioned please see, for example, the chapter on Activating the Disconnect/Terminate Dialog in the configuration guide for the product you are using. E.g, in Workstation it is in Chapter 11, section 4.
https://knowledgebase.nomachine.com/DT11R00174