Safer module filename access.

This should help us avoid reading `None` filenames from the modules
dictionary.

Closes #17