Prevent panic when aptempting closing statement if statement is nill

That was preventing the base SQL/mapping error to be reported.