Convert all libc functions to using FS.getStream
minor fixes to return codes of closedir, telldir