Fix for some fds remained opened because not closed due to unix errors