minuitwrp: fix file descriptor leak in open_png

This fixes missing images after reloading the material theme 3 times.

Change-Id: I9af2a76b16e465fd2218e5f479c36a294590fa62
diff --git a/minuitwrp/resources.c b/minuitwrp/resources.c
index 680bf56..3e3375d 100644
--- a/minuitwrp/resources.c
+++ b/minuitwrp/resources.c
@@ -54,7 +54,7 @@
 }
 
 static int open_png(const char* name, png_structp* png_ptr, png_infop* info_ptr,
-                    png_uint_32* width, png_uint_32* height, png_byte* channels) {
+                    png_uint_32* width, png_uint_32* height, png_byte* channels, FILE** fpp) {
     char resPath[256];
     unsigned char header[8];
     int result = 0;
@@ -131,6 +131,7 @@
         png_set_palette_to_rgb(png_ptr);
     }
 
+    *fpp = fp;
     return result;
 
   exit:
@@ -219,10 +220,11 @@
     png_infop info_ptr = NULL;
     png_uint_32 width, height;
     png_byte channels;
+    FILE* fp;
 
     *pSurface = NULL;
 
-    result = open_png(name, &png_ptr, &info_ptr, &width, &height, &channels);
+    result = open_png(name, &png_ptr, &info_ptr, &width, &height, &channels, &fp);
     if (result < 0) return result;
 
     surface = init_display_surface(width, height);
@@ -247,6 +249,7 @@
     *pSurface = (gr_surface) surface;
 
   exit:
+    fclose(fp);
     png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
     if (result < 0 && surface != NULL) free(surface);
     return result;