Check IO errors in test using `raw_os_error()` instead of `kind()`