Clean up. tofile now calls array_tofile.

Changed
-------
* The tofile function now calls array_tofile with writing a grid field
  to a file.
* tofile will now append the variable name to the file name if multiple
  fields are printed.
Unit tests for tofile and array_tofile.