There is a free extension for that. It allows you to show the session messages as floating divs and adds a close button to them, or it can even close the messages after a number of seconds.
If you don't want an extension, you can rewrite the method
getGroupedHtml from the class
Mage_Core_Block_Messages and insert your button in there.