added method to write data to files.  For doubles, it writes more decimal places than we usually need, but it's probably best for maintaining as much precision as possible