docs: @Override
  	@SuppressWarnings("resource")
  	public void close() throws IOException {
  		flush();
  
  		if (this.tempStream != null) {
  			this.tempStream.close();
  			this.tempStream = null;
  		}
  
  		if (this.stream != null && this.stream.isOpen()) {
  
  			// Copy the channels
  			if (this.buffer != null && this.tempFile != null) {
  				try {
  					try (ReadableByteChannel in = Channels.newChannel(new FileInputStream(this.tempFile))) {
  						final ByteBuffer hbuffer = ByteBuffer.allocate(100);
  						in.read(hbuffer);
  
  						hbuffer.limit(100);
  						hbuffer.position(6 * 4);
  						hbuffer.order(ByteOrder.BIG_ENDIAN);
  						hbuffer.putInt(toESRIWords(this.bufferPosition));
  						hbuffer.rewind();
  						this.stream.write(hbuffer);
  
  						int nbRead;
  						this.buffer.rewind();
  
  						while ((nbRead = in.read(this.buffer)) >= 0) {
  							this.buffer.rewind();
  							this.buffer.limit(nbRead);
  							this.stream.write(this.buffer);
  							this.buffer.rewind();
  							this.buffer.limit(this.buffer.capacity());
  						}
  					}
  
  				} finally {
  					this.tempFile.delete();
  					this.tempFile = null;
  				}
  
  			}
  			this.stream.close();
  		}
  	}