Actually saving the file
Fixed error case