This occurs when the file is being locked by another application. Check if another process is accessing the same file. On Windows follow this post to figure it out : https://goo.gl/yPp1To
If it's being used, terminate that process to gain access.
When you iterate over the lines of a scala.io.Source with source.getLines, make sure you do not close the source until you processed the iterator.