Fix unchecked opening of DNS resolver socket