Improve error messages for io::fs

Continuation/rebasing of #14810