I have tried various solutions to send a message when a user close his window but nothing is working. I have come up with this code but the function is not executing. Have I