make sure that file/folder exists when stream emits an error