CheckCommand.py: fix race condition