it should work by adding the code to unset the session after the closing HTML like you have already tried.
if you are not able to get that to work, then you will need to use a thank you page instead of dynamically setting the thank you message.
Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.
These out-of-the-box solutions provide you proven, tested applications that can be up and running now. Build a store, a gallery, or a web-based email solution.