replace whitespace in cached filename

Update `make_cached_name` to support filenames with spaces. Fixes part a of issue #514