Tcl module fixes

Various fixes w.r.t. `modules.py` and its unit tests.

This should fix #733 and #734.

Currently still a WIP, since some tests still fail in certain circumstances, see https://jenkins1.ugent.be/view/EasyBuild%20(boegel)/