I think you need to do everything in deinit() and then init() to create window, surface etc
printf("Cleaning up...\n");
eglMakeCurrent(egldisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
assert(eglGetError() == EGL_SUCCESS);
eglDestroyContext(egldisplay, eglcontext);
eglDestroySurface(egldisplay, eglsurface);
fsl_destroywindow(eglNativeWindow, eglNativeDisplayType);
eglTerminate(egldisplay);
assert(eglGetError() == EGL_SUCCESS);
eglReleaseThread();