Close the file managed by this LogFileHandle instance.

@exception InternalLogException An unexpected error has occured.
342930
void fileClose() throws InternalLogException
    {
        if (tc.isEntryEnabled())
            Tr.entry(tc, "fileClose", this);

        if (_fileChannel != null)
        {
            try
            {
                // Don't close channel as it will free a lock - wait until file close

                if (_outstandingWritableLogRecords.get() == 0 && !_exceptionInForce)
                {
                    force(); // make sure all records really are on disk

                    // Now we know that there are no gaps in the records and none have failed
                    // to be written, byte by byte scanning at the next start can be avoided.
                    _logFileHeader.setCleanShutdown(); // set the fact that shutdown was clean
                    writeFileHeader(false); // write clean shutdown into header
                    force();
                }

                _file.close();
            } catch (Throwable e)
            {
                FFDCFilter.processException(e, "com.ibm.ws.recoverylog.spi.LogFileHandle.fileClose", "541", this);
                if (tc.isEntryEnabled())
                    Tr.exit(tc, "fileClose", "InternalLogException");
                throw new InternalLogException(e);
            }

            _fileBuffer = null;
            _file = null;
            _fileChannel = null;
        }

        if (tc.isEntryEnabled())
            Tr.exit(tc, "fileClose");
    }
420675
public void close() throws IOException {
        if (jarOutputStream != null) {
            jarOutputStream.close();
        }
        else if (os != null) {
            os.close();
        }
    }
1185141
@Override
    public void close () throws IOException {
        try {
            SmbFileHandleImpl h = this.handle;
            if ( h != null ) {
                h.close();
            }
        }
        catch ( SmbException se ) {
            throw seToIoe(se);
        }
        finally {
            this.tmp = null;
            this.handle = null;
            if ( this.unsharedFile ) {
                this.file.close();
            }
        }
    }
1292098
public void internalClose() throws ThriftConnectionPoolException {
		try {
			if (this.thriftConnection != null) {
				this.thriftConnection.close();
			}
			logicallyClosed.set(true);
		} catch (IOException e) {
			throw new ThriftConnectionPoolException(e);
		}
	}
870076
@Override
    public void close() throws Exception
    {
        BufferedWriter writer = null;
        try
        {
            FileWriter fw = new FileWriter(file.getAbsoluteFile());

            writer = new BufferedWriter(fw);

            String header = layout.getFileHeader();
            if (header != null)
            {
                writer.append(header);
            }
            String presentationHeader = layout.getPresentationHeader();
            if (presentationHeader != null)
            {
                writer.append(presentationHeader);
            }
            int len = buffer.length();
            for (int i = 0; i < len; i++)
            {
                ILoggingEvent event = buffer.get();
                writer.append(layout.doLayout(event));
            }

            String presentationFooter = layout.getPresentationFooter();
            if (presentationFooter != null)
            {
                writer.append(presentationFooter);
            }
            String footer = layout.getFileFooter();
            if (footer != null)
            {
                writer.append(footer);
            }
        }
        finally
        {
            if(writer != null)
            {
                writer.flush();
                writer.close();
            }
        }
    }
402110
@Override
  public void closeImpl() throws IOException
  {
    unlock();

    _fileChannel = null;

    RandomAccessFile file = _file;
    _file = null;

    if (file != null)
      file.close();
  }
1063196
@Override
    public void closeFile() throws JournalException {
        try {
            super.testStateChange(State.FILE_CLOSED);
            parent.writeDocumentTrailer(xmlWriter);
            xmlWriter.close();

            /*
             * SOME implementations of XMLWriter do not close all resources, so
             * we need to close the rmi manually just in case.
             */
            try {
                writer.close();
            } catch (IOException e) {
                throw new JournalException(e);
            }
            super.setState(State.FILE_CLOSED);
        } catch (XMLStreamException e) {
            throw new JournalException(e);
        }
    }
89049
@Override
  public final void close() {
    try {
      doClose();
      isClosed = true;
    } catch (Exception e) {
      Throwables.propagate(e);
    }
  }
1333625
public void close() throws IOException {
    try {
      if (OGlobalConfiguration.FILE_LOCK.getValueAsBoolean())
        unlock();
      if (channel != null && channel.isOpen()) {
        channel.close();
        channel = null;
      }

      if (accessFile != null) {
        accessFile.close();
        accessFile = null;
      }

    } catch (Exception e) {
      OLogManager.instance().error(this, "Error on closing file " + osFile.getAbsolutePath(), e, OIOException.class);
    }
  }
175036
@SuppressWarnings("resource")
	@Override
	public void close() throws IOException {
		if (this.tmpFile.canRead()) {
			try {
				this.tmpOutput.close();

				try (WritableByteChannel out = Channels.newChannel(this.output)) {
					try (ReadableByteChannel in = Channels.newChannel(new FileInputStream(this.tmpFile))) {
						// Write the header
						final int limit = HEADER_KEY.getBytes().length + 6;
						final ByteBuffer hBuffer = ByteBuffer.allocate(limit);
						hBuffer.limit(limit);
						in.read(hBuffer);
						hBuffer.position(HEADER_KEY.getBytes().length + 2);
						hBuffer.putInt(this.length);
						hBuffer.rewind();
						out.write(hBuffer);
						// Write the objects
						final ByteBuffer buffer = ByteBuffer.allocate(4096);
						int read;
						while ((read = in.read(buffer)) >= 0) {
							buffer.rewind();
							buffer.limit(read);
							out.write(buffer);
							buffer.rewind();
							buffer.limit(buffer.capacity());
						}
					}
				}
			} finally {
				this.tmpFile.delete();
			}
		}
	}
174495
static public void close(FileSystemManager fsManager){
		if (fsManager != null){
			if (fsManager instanceof DefaultFileSystemManager){
				((DefaultFileSystemManager) fsManager).close();
			}else{
				throw new IllegalStateException("Only instance of DefaultFileSystemManager can be closed here.");
			}
		}
	}
1138791
public synchronized void close() throws IOException {
        if (logStream != null) {
            logStream.close();
        }
        for (FileOutputStream log : streamsToFlush) {
            log.close();
        }
    }
1266394
public static void closeQuietly(final JarFile aJarFile) {
        if (aJarFile != null) {
            try {
                aJarFile.close();
            } catch (final IOException details) {
                LOGGER.error(details.getMessage(), details);
            }
        }
    }
967173
public void closeAndDelete() throws JournalException
    {
    	close();
    	if (!file.delete())
    	    if (file.exists())
    	        throw new JournalException("Cannot delete journal file : "+file.getAbsolutePath());
    }
1298301
public static void closeFileStream(InputStream inputStream, String filePath){
        try {
            if (inputStream != null) {
                inputStream.close();
            }
        } catch (IOException e) {
            LOG.error("close file {} occur an IOExcpetion {}", filePath, e);
        }
    }
1089786
public static void safelyClose(OutputStream stream) {
		if(stream != null) {
			try {
				stream.close();
			} catch(IOException e) {
				logger.warn("error closing internal output stream, this may lead to a stream leak", e);
			}
		}
	}
1142855
public void close() throws Exception {
        this.files.clear();
        this.files = new ArrayList<File>();
        this.iterator = this.files.iterator();
    }