Implemented file opening/closing, started main loop

Currently we only iterate once because we force the checked character to
be eof, to prevent infinte loops before we finish writing the rest of
the loop.