check file exists before removing