- Added checks on pointers passed to system calls.
- Implemented closing of all open files on exit.