What about:

```ruby
File.open(input_path, 'r') do |input|
  File.open(output_path, 'w') do |output|
    ...
  end
end
```

Will make sure fds are always closed, even in case of an error happening.