Make distinct types for files and strings
As the documentation suggests, the argument may either be a file or a string. If the "file" type is a filename, there is no way to distinguish them, except at the exact time of running the function, if there happens to be a file with the given name. This is harmful, because a malicious document containing the file name of a sensitive file could leak the contents of the sensitive file.
If we use a port instead of a file name, it's better because we can't get a port by accident.