protected static function tempnamHandler($dir, $prefix, $cb, &$tries)
    {
        $cb = CallbackWrapper::forceWrap($cb);
        if (++$tries >= 3) {
            $cb(false);
            return;
        }
        $path = FileSystem::genRndTempnam($dir, $prefix);
        FileSystem::open($path, 'x+!', function ($file) use ($dir, $prefix, $cb, &$tries) {
            if (!$file) {
                static::tempnamHandler($dir, $prefix, $cb, $tries);
                return;
            }
            $cb($file);
        });
    }