Updating all write functions.

Updating all write functions to require a `FILE` pointer as the
first argument. This required minor changes throughout much of
the code.