This is a naive implementation of closefrom() which closes all FDs starting from the one passed in argument. closefrom() is not provided on all operating systems, and other versions will follow.