Does Julia lang has something like a destructor or finalizer for structs?
There are finalizers:
help?> finalizer search: finalizer UndefInitializer finalize finalizer(f, x) Register a function f(x) to be called when there are no program-accessible references to x, and return x. The type of x must be a mutable struct, otherwise the behavior of this function is unpredictable. f must not cause a task switch, which excludes most I/O operations such as println. @schedule println("message") or ccall(:jl_, Cvoid, (Any,), "message") may be helpful for debugging purposes.
Note that the help message is not correct and has been replaced in the master documentation.