Added posibility to overwrite file

There were no possibility to overwrite file. Comparision was made by filename only, so it might create conflict event for different files. Also changed exit() to rised exception.