Cleans up a filename to ensure it will work on filesystem.