POSIX/UNIX: How to reliably close a file descriptor POSIX/UNIX: How to reliably close a file descriptor multithreading multithreading