Fix the OnClose crash when decoding is not finished