before the line
there should be
Without that the isFriend xml element which is created won't be properly closed.
Moreover, the element name should be isFriendResponse according to XEP-0324 (https://xmpp.org/extensions/xep-0324.html).
Feel free to correct me if I'm wrong. I'm pretty new in the community, just working on my thesis for my undergraduate degree.