Fixes fileWriteError param reference error

Also updates all "e" vars to "err" for consistency.