Fix for #1677
Merge pull request #1713 from juancarlospaco/fix/openfile

Fix for #1677