engine.py: Fix use of semaphore.

re: chfoo/wpull#168