Added code to commit current edits when losing focus.