Delete Record when closing window

I have developed a chat application using flash CS3. And there is a “Sign out” button which will delete users record from database (through php).

But some users may simply close the browser window without even logging out. I want to know is it possible to delete the user’s record from database when the user closes the window?