Petra Kvitova came through a tight encounter with world number one Ashleigh Barty to book her place in the Qatar Open final.