Avoid mistaking pid and configuration directories for files

Using File.exist? instead of File.file? gives a false-positive result
when the path argument is a directory (such as '.') instead of a file.
Merge pull request #7 from njonsson/file-existence

Avoid mistaking pid and configuration directories for files