Add the ability to close sessions. This adds *_free() functions to most