I suggest adding a timer to the script. Which the user can customise to what they want, e.g. make the window close after 10 seconds of the contact signing out. I personally would want it 10 minutes after a contact signed out. I often have tabs with tons of offline contacts who I stopped speaking to say, an hour ago
.
Adding a timer would make the script a lot better
.