Fixed the inverted condition in toggle_read_only. Also calling this function a second time in main, once the backup is completed, to restore write mode.