49018a55d1
There was no garanty that the corresponding thread destructor had been already called when exiting the closeOutput() or closeInput() functions. This contructor could be called by the thread after the exit condition is signalled. By way of consequence, closeOutputStream() could be called after we exited closeOutput() function. To solve the problem, the call to closeOutputStream() or closeInputStream() is moved to closeOutput() or closeInput().