Use a root constant to handle a different current working directory and use the block form of open to ensure the file is closed if errors occur while it is open as in the above comment.