End database session before closing application.