clean up the way that output arrays are written to FITS