Implemented write an exit system calls