Try invoking parent close() via super(), hoping to squash ResourceWarning.

Also, avoid shadowing the 'file' builtin / alias with locals.
Bend over backward to avoid ResourceWarnings.