track written files
better error reporting