Force the module to stay resident after being loaded (otherwise it
will crash if it's loaded, unloaded, and loaded again, because it will
fail to register its types the second time).
Also fix a few bugs in the unload() function, even though it is no
longer used at this point. To be fixed for 3.4.