When using the past perfect tense to say something happened before something else, is it correct to use the gerund form (as opposed to the past tense) to express the latter event? For example, is it correct to say:
I had given him the book before leaving for Canada.
Or is it only correct to say:
I had given him the book before I left for Canada.