Fixed a crash caused by trying to deallocate already freed graphics buffers in certain situations.