fixed that fd is never closed. fixed #1