Close the previous document when opening a new one
Use the proper prefix for the "file" protocol