Fix file handle race
Fix file handle race

If a pipe stream is created with read and write handle set to the same
value, the destroy method tries to close the same file descriptor twice.
However, the scheduler could choose another thread in between that opens
a file and gets the unused file descriptor re-assigned.

Signed-off-by: David Oberhollenzer <ef97309e490485c1bad5018f0617d7fa37bc07ac@tele2.at>

AgentD/ctools,AgentD/ctools,AgentD/ctools