terminate processes before attempting rm