Closed file streams and added hex debug code.