edit and close a file