docs: @Override
      public void close() throws IOException {
          if (out != null) {
              IOException ex = null;
              try {
                  if (position > 0) {
                      if (breakLines && lineLength >= Base64.MAX_LINE_LENGTH) {
                          if (crlf) {
                              out.write(Base64.CR);
                          }
                          out.write(Base64.LF);
                      }
  
                      int len = Base64.encode3to4(buffer, 0, position, b4, 0, noPadding, alphabet);
                      out.write(b4, 0, len);
                  }
                  out.flush();
              } catch (IOException e) {
                  ex = e;
              }
  
              try {
                  // 2. Actually close the stream
                  // Base class both flushes and closes.
                  if (close) {
                      out.close();
                  }
              } catch (IOException e) {
                  if (ex != null) {
                      ex.addSuppressed(e);
                  } else {
                      throw e;
                  }
              } finally {
                  out = null;
              }
  
              if (ex != null) {
                  throw ex;
              }
          }
      }