Fixed an issues with saving to the same file twice.