Fixed race-associated thread leak in bufpipe