changed writer to append to output file, and dealt with case where there are no occurrences of words in the selected timeframe (although this should be made more robust)
added code to ignore timeframes with very few total word occurrences