close window when shiny application is stopped