Fix deletion order in QImageReader/Writer destructors
The device would be deleted before the image format handler, and hence be a dangling pointer that could easily cause a crash if the handler or codec would access it on destruction, e.g. for cleanup.
Pick-to: 6.5 6.4 6.2 5.15 Change-Id: I51d16b1feddc5945955ac75a2e8701233dba7b82 Reviewed-by: Paul Olav Tvete paul.tvete@qt.io (cherry picked from commit f091026b)