fixed typo `waitForWriting`. thanks @kaochenlong