Must not use URL directly when opening path.

As described in #730, if the path contains a character that gets URL encoded things break. Use toURI() and the proper FIle constructed.