docs: public synchronized final void closeStream() {
          try {
              if ((stream != null) && (streamState == StreamStates.OPEN)) {
                  stream.close();
                  stream = null;
              }
              streamState = StreamStates.CLOSED;
          } catch (IOException e) {
              e.printStackTrace();
          }
      }