Australia deny Pakistan in gripping Test finale