title: Kafka can not access the file because it is being used by another process
body: <p>I have a problem installing Kafka on  windows.
  I installed  kafka cluster of 3 instances in 3 differents servers (each server contain one kafka and zookeeper )
  all work well, but when an instance kafka stop (or fail ) , when i try to restart this instance .
  I have this error message:</p>
  
  <pre><code>`[2017-11-10 15:17:53,999] INFO [ThrottledRequestReaper-Fetch]: Starting 
  (kafka.server.ClientQuotaManager$ThrottledRequestReaper)
  [2017-11-10 15:17:53,999] INFO [ThrottledRequestReaper-Produce]: Starting 
  (kafka.server.ClientQuotaManager$ThrottledRequestReaper)
  [2017-11-10 15:17:53,999] INFO [ThrottledRequestReaper-Request]: Starting 
  (kafka.server.ClientQuotaManager$ThrottledRequestReaper)
  [2017-11-10 15:17:54,109] INFO Loading logs. (kafka.log.LogManager)
  [2017-11-10 15:17:54,171] WARN Found a corrupted index file due to 
  requirement failed: Corrupt index found, index file (C:\Tools\Kafka\kafka-
  logs\hubone.dataCollect.orbiwise.ArchiveQueue-0\00000000000000000015.index) 
  has non-zero size but the last offset is 15 which is no larger than the base 
  offset 15.}. deleting C:\Tools\Kafka\kafka-
  logs\hubone.dataCollect.orbiwise.Arch`iveQueue-
  0\00000000000000000015.timeindex, C:\Tools\Kafka\kafka-
  logs\hubone.dataCollect.orbiwise.ArchiveQueue-0\00000000000000000015.index, 
  and C:\Tools\Kafka\kafka-logs\hubone.dataCollect.orbiwise.ArchiveQueue-
  0\00000000000000000015.txnindex and rebuilding index... (kafka.log.Log)
  [2017-11-10 15:17:54,171] ERROR There was an error in one of the threads 
  **during logs loading: java.nio.file.FileSystemException: 
  C:\Tools\Kafka\kafka-logs\hubone.dataCollect.orbiwise.ArchiveQueue-
  0\00000000000000000015.timeindex: The process cannot access the file because 
  it is being used by another process.**
  (kafka.log.LogManager)
  [2017-11-10 15:17:54,171] FATAL [Kafka Server 1], Fatal error during 
  KafkaServer startup. Prepare to shutdown (kafka.server.KafkaServer)
  java.nio.file.FileSystemException: C:\Tools\Kafka\kafka-
  logs\hubone.dataCollect.orbiwise.ArchiveQueue-
  0\00000000000000000015.timeindex: The process cannot access the file because 
  it is being used by another process.
  
  at sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:86)
  at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:97)
  at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:102)
  at sun.nio.fs.WindowsFileSystemProvider.implDelete(WindowsFileSystemProvider.java:269)
  at sun.nio.fs.AbstractFileSystemProvider.deleteIfExists(AbstractFileSystemProvider.java:108)
  at java.nio.file.Files.deleteIfExists(Files.java:1165)
  at kafka.log.Log$$anonfun$loadSegmentFiles$3.apply(Log.scala:318)
  at kafka.log.Log$$anonfun$loadSegmentFiles$3.apply(Log.scala:279)
  at scala.collection.TraversableLike$WithFilter$$anonfun$foreach$1.apply(TraversableLike.scala:733)
  at scala.collection.IndexedSeqOptimized$class.foreach(IndexedSeqOptimized.scala:33)
  at scala.collection.mutable.ArrayOps$ofRef.foreach(ArrayOps.scala:186)
  at scala.collection.TraversableLike$WithFilter.foreach(TraversableLike.scala:732)
  at kafka.log.Log.loadSegmentFiles(Log.scala:279)
  at kafka.log.Log.loadSegments(Log.scala:383)
  at kafka.log.Log.&lt;init&gt;(Log.scala:186)
  at kafka.log.Log$.apply(Log.scala:1609)
  at kafka.log.LogManager$$anonfun$loadLogs$2$$anonfun$5$$anonfun$apply$12$$anonfun$apply$1.apply$mcV$sp(LogManager.scala:172)
  at kafka.utils.CoreUtils$$anon$1.run(CoreUtils.scala:57)
  at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
  at java.util.concurrent.FutureTask.run(FutureTask.java:266)
  </code></pre>
  
  <p>when i delete kafka-logs , the offsets are corrupted .
  could you help me to fix this problem ?</p>
  
  <p>i opened an issue in kafka :
  <a href="https://issues.apache.org/jira/browse/KAFKA-6200" rel="nofollow noreferrer">https://issues.apache.org/jira/browse/KAFKA-6200</a></p>