Added functionality to create header row when writing a query

To resolve Issue #57