Fix handling of duplicate copy for local copies.

Do not use the imgid into the local-copy cache filename to have a single
original picture for all duplicate. This can save disk spaces.

Delete the local cache copy only when there is no more images (duplicate)
referencing it. Note that we also now properly delete cached XMP for
duplicate.

Note that the old scheme is kept for upward compatibility. So as long as
there is a local copy with the old naming scheme it will be used.
Merge pull request #704 from darktable-org/fix-dup-local-copy

Fix handling of duplicate copy for local copies.