Fix crash on not finding a file in a bundle
Before this commit, if something requested a file that wasn't in the
bundle, Krita would crash, because the store cannot be open but its
device is later used.
This commit ensures that the function is ended as soon as Krita
discovers that the store cannot be opened to get the file.