Set isInTransaction to false even if close throws