Fix build without libpng
diff --git a/utils/ImageOutputDev.cc b/utils/ImageOutputDev.cc
index 63f7399..90e9ced 100644
--- a/utils/ImageOutputDev.cc
+++ b/utils/ImageOutputDev.cc
@@ -13,7 +13,7 @@
 // All changes made under the Poppler project to this file are licensed
 // under GPL version 2 or later
 //
-// Copyright (C) 2005, 2007, 2011 Albert Astals Cid <aacid@kde.org>
+// Copyright (C) 2005, 2007, 2011, 2018 Albert Astals Cid <aacid@kde.org>
 // Copyright (C) 2006 Rainer Keller <class321@gmx.de>
 // Copyright (C) 2008 Timothy Lee <timothy.lee@siriushk.com>
 // Copyright (C) 2008 Vasile Gaburici <gaburici@cs.umd.edu>
@@ -620,9 +620,9 @@
     }
 
     writeImageFile(writer, format, "png", str, width, height, colorMap);
-#endif
-    delete writer;
 
+    delete writer;
+#endif
   } else if (outputTiff) {
     // output in TIFF format