Added check for existing file to fix error if it gets deleted