Fixed bug in refreshing command
Added automatic saving of the open file