The correct option is B leaving
Adverbs modify verbs, adjectives and sometimes other adverbs in a sentence.
In this sentence, the adverb 'just' is modifying the verb 'leaving'. The adverb suggests the time of his leaving. Hence, Option B is correct.
Option A is incorrect because 'he' is a pronoun. Adverbs don't modify pronouns.
Option C is incorrect as 'just' is itself the adverb.
Option D is obviously incorrect.