Fix #4985: multi-threaded save code
This branch takes the patch from @suzu_11 at #4985 (closed), do some cleaning, a bit of code reorganization and added support for zlib-compression too (it was for RLE only initially).
This branch takes the patch from @suzu_11 at #4985 (closed), do some cleaning, a bit of code reorganization and added support for zlib-compression too (it was for RLE only initially).