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

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