Expose “open” and “transaction” flags in BaseSession.

You still need to cast down to BaseSession to see them, so they are not
part of the official API, but can be used for integrating other session
management features.

Fixes issue #713. Review by @cvogt