Bug fixes when calling close() on a a session that was not fully opened.