fix missing O_WRONLY in append modes
replace path with file-like object