Added functionality so that the code will only write a clean dataset for a given year and month, added code to close the out_channel