write failed output to file