code: public void close() throws IOException {
          for (;;) {
              int state = this.state;
              if (isClosed(state)) {
                  return;
              }
              // Once a close operation happens, the channel is considered shutdown.
              if (casState(state, state | STATE_ALL_MASK)) {
                  break;
              }
          }
          int res = close(fd);
          if (res < 0) {
              throw newIOException("close", res);
          }
      }
docs: Close the file descriptor.