Another fix

Registry session variable closing was placed outside correct scope.
Fixed