Fixed some trivial warnings and some bugs in syscalls

- getdents() should set seek_pos after reading the directory
- close() should fail if file descriptor is invalid