add missing os import and fix undefined gen_log

import absence resulted in incorrect behaviour of
ZMQIOLoop's `close` method. Also fixed gen_log variable
NameError.
Merge pull request #365 from FZambia/patch-1

add missing os import and fix undefined gen_log