Fix reference counting in both versions of scandir_helper (Issue #6)

This branch should fix all the memory leak and reference count issues. Tested it on windows and linux.