vlib: fix clear trace buffer race condition