directory.open now reads all entries at start

Updated directory.open to read all directory contents at start
rather than during iteration in order to avoid any file
problems during iteration such as unreadable files or dangling
symlinks, etc.

See https://github.com/imatix/gsl/issue/12

Testable with:

gsl -script:testdir2.gsl testdir.xml