db() now also returns the session
Fixed to close session to db