Fixed incorrectly closing a non existing descriptor when no output is specified