use ensure_clean rather than explicit os.remove #34384
closes #34384 
I have made a start at this issue #34384. Please let me know if I am along the right lines (beginner contributor).

I've left a space in code_checks.sh where I expect to implement the check for instances of 'os.remove' throughout the code.