Suggest using the block form of file so you don't have to deal with open/close and errors.

```ruby
File.open('/etc/fstab', 'w') do |f|
  # stuff with f
end
```

In addition, f.puts will give you the carriage return, so you don't need to add it yourself.  To me it makes the intent slightly clearer.