Commits DB transaction and closes the session.