files: don't close a file descriptor when opening failed  [coverity scan]

Also, don't depend on statting the relative path, because if that would
fail, we would try to open a NULL pointer.
1 file changed