Morphological closing removes thin, dark features:
Use morphological closing to remove salt-and-pepper noise from a color photo:
Remove small holes in foreground objects:

works with graphics objects:
Using
CUDAMemory, one can speed up computation by reducing the amount of memory operations. This loads memory onto the CPU:
This performs the closing operation:
This gets the memory back to the CPU: