code: public void close() throws IOException
  	{
  		// atomically set the close flag
  		synchronized (this.closeLock) {
  			if (this.closed) {
  				return;
  			}
  			this.closed = true;
  			
  			try {
  				// wait until as many buffers have been returned as were written
  				// only then is everything guaranteed to be consistent.{
  				while (this.requestsNotReturned.get() > 0) {
  					try {
  						// we add a timeout here, because it is not guaranteed that the
  						// decrementing during buffer return and the check here are deadlock free.
  						// the deadlock situation is however unlikely and caught by the timeout
  						this.closeLock.wait(1000);
  						checkErroneous();
  					}
  					catch (InterruptedException iex) {}
  				}
  			}
  			finally {
  				// close the file
  				if (this.fileChannel.isOpen()) {
  					this.fileChannel.close();
  				}
  			}
  		}
  	}
docs: Closes the reader and waits until all pending asynchronous requests are
  handled. Even if an exception interrupts the closing, the underlying <tt>FileChannel</tt> is
  closed.
  
  @throws IOException Thrown, if an I/O exception occurred while waiting for the buffers, or if
  the closing was interrupted.