Don't proceed with file operations when we know the file doesn't exist

Fixes issue 2448.