Correctly reset buffer for nested asynchronous file stream writes. Fixes #12777