Ensure modal window is closed when saving.