vtl: fix possible race condition when terminating external program