Fixed bug where variable filename was referenced before assignment when ...

...the user did not pass profiles/save_as a parameter. Tested this to ensure my changes did not break existing functionality