more robust detection of Shiny satellite window closure