Fix file handling code to correctly fail under Python 2.7

FileNotFoundError is not defined under 2.7, so a subclass of IOError is created for anything below 3.0. Also, as 2.7 doesn't handle invalid parameters well the filename is coerced into unicode before passing to exists().