win32_fflush(pf);
err = closesocket(osf);
if (err == 0) {
+#if defined(USE_FIXED_OSFHANDLE) || defined(PERL_MSVCRT_READFIX)
_set_osfhnd(fileno(pf), INVALID_HANDLE_VALUE);
+#endif
(void)fclose(pf); /* handle already closed, ignore error */
return 0;
}