Check whether a file exists when adding enclosures (see #6173)