Fix error handling to resolve SEGFAULT.

do_open doesn't return errors properly since 0 is a valid UNIX fd but is an
invalid pointer. I fixed the hack to just have a static file that is open for
the whole program.