Runs, but resets when trying to print the values.
Changed write commands, but opening the file seems to fail.