Modified savefile() to be up to relax' standards and to match the operation of openfile().
The current working directory is changed if the directory arg is not given.
Authored by: bugman 2010-01-26
Parent: [r10378]
Child: [r10380]