Fix hciconfig leadv returned response

Fixes hciconfig leadv returned response by treating both status of the
command execution and HCI error code.
diff --git a/tools/hciconfig.c b/tools/hciconfig.c
index c271d14..05a8910 100644
--- a/tools/hciconfig.c
+++ b/tools/hciconfig.c
@@ -269,11 +269,20 @@
 	rq.rlen = 1;
 
 	ret = hci_send_req(dd, &rq, 100);
-	if (status || ret < 0)
-		fprintf(stderr, "Can't set advertise mode on hci%d: %s (%d)\n",
-						hdev, strerror(errno), errno);
 
 	hci_close_dev(dd);
+
+	if (ret < 0) {
+		fprintf(stderr, "Can't set advertise mode on hci%d: %s (%d)\n",
+						hdev, strerror(errno), errno);
+		exit(1);
+	}
+
+	if (status) {
+		fprintf(stderr, "LE set advertise enable on hci%d returned status %d\n",
+						hdev, status);
+		exit(1);
+	}
 }
 
 static void cmd_le_states(int ctl, int hdev, char *opt)
@@ -302,7 +311,7 @@
 
 	err = hci_send_req(dd, &rq, 1000);
 
-	close(dd);
+	hci_close_dev(dd);
 
 	if (err < 0) {
 		fprintf(stderr, "Can't read LE supported states on hci%d:"