code: protected void close() throws IOException {
          synchronized(fdLock) {
              if (fd != null && fd.valid()) {
                  if (!stream) {
                      ResourceManager.afterUdpClose();
                  }
                  if (closePending) {
                    return;
                  }
                  closePending = true;
                  socketClose();
                  return;
              }
          }
      }
docs: Closes the socket.