Fixed bugs #47675 and #64577 (fd leak on Solaris)