Add RAII to ug domain creation/deletion in grid factory
The ugDomain (I don't know what exactly this is) seems to be created and destroyed without RAII. This MR at least fixes the memory leaks from #188 (closed) by using RAII when the first pointer is created.
Close #188 (closed)