Save changes on mouseleave