catches exception when closing statements and logs them

catches exception when closing statements and logs them
optimized imports