Detect and report failures to open the marks file
[fix-submodule-refs] better error reporting
Write marks files in the correct place