Use global variable to capture referenceSet for file listing rather than calling document()

Fixes issues where identifiers appear not to resolve - the pipeline was actually getting stuck
Merge pull request #239 from datadryad/dan-fix-resource-resolving

Use global variable for file listing rather than calling document() to get the DRI again