Complete module init/destroy when starting/stopping a main-loop.
Observe chdir() return value.