Nations inch towards climate deal at marathon UN summit