Maybe the do-block form of open would be better to suggest?
open("fileout.txt", "a") do io
Printf.format(io, s, Inf, Inf, NaN, NaN)
end
That way the file handle is still closed in case format throws an exception (using a try-finally block under the hood).