added exception handling to IR_Output_kMeans.py