Use 'opener' instead of 'open_func'
Use 'os.replace' when available, use 'self.file' instead of 'self.fd'