overwrite the file before delete it