close filewriter with \n escape