Use image-kill-buffer instead. (doc-view-mode): Add `doc-view-kill-proc' to `kill-buffer-hook'.
Attach a file by drag & drop or click to upload