fixed the imputation method so they write to a csv output and did error handling in case the imputation fails