"The iTunes library file cannot be saved. A folder was specified instead of a file." ...what?
This is a possible solution that I came across and (initially) it seems to have worked for me:

Quoted from Apple Support Communities:


  I assume the problem is gone now and here's what I did to get rid of it:
  
  
  stop iTunes
  alt-start iTunes, so it offers 'Create Library' and 'Choose Library'
  choose 'Create Library' to create a new library (iTunes 1)
  stop iTunes
  alt-start iTunes, so it offers 'Create Library' and 'Choose Library'
  choose 'Choose Library' and chose my main library, which caused me so much pain 
  
  
  since then no more tmp files are left over in the iTunes folder and I hope it stays like this