Refactored to have CheckFile take in a filehandle as an argument, and the path to the file as a separate argument, since filehandles refer to file descriptors not absolute paths per POSIX and absolute paths can change or have multiple references per file descriptor and we need to note the file path, not the descriptor value