Resolved integer saving issues.

Open files with "wb" else the integer 10 will get you.
Replaced fwrite with write since fwrite was including a bunch of other
stuff we didn't want.