TS-2144 Avoid race on e.g. -Cclear which would crash the process
Added TS-2144.