fix closing if twisterd is not executed
to be sure read/write use utf-8 encoding
use intrinsic node.js escaping for path