NSW upper house wraps up energy debate