I'm not sure I understand why you would want to log off after the test stops, why not have the final step of the test log off?
Also from your question it sounds like you're talking about manually stopping the test
when i stop the test run, it should automatically logoff from the site
This seems to be an un-interesting case, if you're manually stopping the test then you can manually log-off and for automatic test runs (which is the point of automatic testing) behave as is required (log off at the last step etc.)
QTP does support closing a browser after the test run (when the test is closed) this is done from the Record and Run Settings
dialog.
All that being said here's a hacky way to get what (I think) you're looking for, have this as the last step of your test:
Browser("Br").Navigate "javascript:setTimeout('document.getElementById(""logout"").click();', 5000); void(0)"
What this does is tell the browser to call a specific function after 5 seconds (5000 milliseconds) (using a bookmaklet), the code being called after 5 seconds clicks on the log off button (you'll have to use the correct id
or otherwise locate the button of course).
As I said I'm not sure I understood your problem so I don't know how helpful this will be.