Why is it that when the program is packaged into an exe, it can run normally the first time it is launched, but an error occurs when it is opened again after being closed?

Why is it that when the program is packaged into an exe, it can run normally the first time it is launched, but an error occurs when it is opened again after being closed?