Hmm, this isn't going to do what you want it to do, because if it fails to lock N fds, it will leave some partially taken.