COR-318: Hibernate session leak with idm

Fix description:
- End session in all cases including exception