Fix error when filename is null

Seen occasionally on Windows when running test/file.jl
Merge pull request #6146 from tkelman/patch-4

Fix error when filename is null