Fix race condition in Writer test