Fix invalid file descriptor reuse while sending DNS query (BZ #15946)