Added function to write genwords to file