Fix system_error behavior on Windows