If i file cant be erased when you try to delete it...
Then how do certain virus delete programs?

Is it coded to delete the program when it isnt in use?