Move cleanup into finally block