public void close() throws IOException {
    if (!closed) {
      finish();
      if (mydeflater){
        deflater.end();
      }
      if(close_out)
        out.close();
      closed = true;
    }
  }