It may take a dedicated clearing of the code with a scan tool to remove the code from the ECU memory. Some codes are like that.
For example, (though I've never tried it), I am not sure that you can clear a glow plug fault code just by fixing what is wrong, i.e., by disconnecting the battery and...