iter_mmap_heap_chunks() tries to read /proc/$PID/maps which only works if the process is currently running. If you are using a core file, it will fail with an exceptions.IOError.
Having iter_mmap_chunks() return immediately if we are processing a core file rather than having an attached process solves it.