Internal refactor: on close, error for write stream