Fix regression with closing file descriptors before exec

cc/ @ab