wrapper.c: cleanup,

* try to skip control sequence in the beginning, doesn't work yet;
* close unusued file descriptors