Fix crash when changing reference image embedding
Crash happened, when a reference was set to embedded, the file was saved
and the linked option was selected.
This fix makes the code more robust by separating the external and
internal (in .kra) filenames.