Merge pull request #3976 from JosJuice/shutdown-clear-codes PatchEngine: Clear active codes on shutdown