Flush session before closing.