You should call __wt_free on files[i] before overwriting it.