Avoid a possible FD leak
Some more chunking bug fixes #131