only close the file descriptor if the file descriptor is not -1 set the file descriptor to -1 after closing it
only close the file descriptor if the file descriptor is not -1
set the file descriptor to -1 after closing it

robotics-at-maryland/log4cpp,robotics-at-maryland/log4cpp,robotics-at-maryland/log4cpp