Consistent placement of type checker's cached information

All calls to `writeCashed*` functions now use `getModuleLocation` to
ensure that the information always lands in the same place in the file
system.

This affects lines 7568 -- 7573 in CheckTypes.

Mark: can you review this and shed some light on the `exists(moduleLoc)`
condition (which makes no longer sense now).