start validating filenames again

The old file-saving code had some code that would prevent files with
invalid characters from being saved. The rules it used were kind of
arbitrary, so I just let the code fall into disuse. But now, I added
different validation rules back to the save code.

If the file doesn't end with .py, or it isn't a legal Python module
name, it will ask you to confirm before saving. It also checks before
overwriting now.