Useless statements made useful!

file.close is not a call to anything.
file.close() is.

Also added .idea to gitignore. Hope it doesn't bother anyone.