[#2212] CID37580:

Also, probably always close the in file descriptor if we open it.
[#2212] CID37598:

did some more of the making sure we don't close negative file
descriptors