`File.open` in begin, so `f` can be `nil` on error.  Use block form of `File.open`.