Fix build problems on Windows

Windows requires readers/writers to be closed before a file is deleted.
Use URI instead of path in the parse failure error message to make the
output identical, and the test pass, on all platforms.