This patch normalizes what the tests do before exiting. After this change each test should call final on the top module and explicitly free the top module object before exiting.