Fix a crash with PGS subtitles.

Crash occurs when trying to deallocate already deallocated memory.

Fixes #4272