Cancel container activation onBeforeUnload


When a user starts a container (for instance by clicking a link) and rapidly closes the tab, the proxy gets activated and it continues to live until heartbeat-timeout is reached.
I have a very large heartbeat timeout, as I rely on the API within R to stop the containers (onSessionEnded()). As, by closing the tab, the user does not start a shiny session, the R code for reaching the API is not executed.
Therefore, I can have several unused containers using RAM unnecessarily during hours.

Would it be possible to cancel the proxy activation, eg. when the users closes the browser’s tab?