Assuming f is a File, yes f.close will close it.
On the other hand, if possible, it's better to use the form of File.open which takes a block
File.open(file_path) do | f | # code that works with the file referenced by f end
This automatically closes the file when the block finishes.