added bulletproofing on potential file cleanup