Is one to wash his hands if only his hand entered into the bathroom, such as to close the door?
Yes.[1] Some[2] rule one is to wash each hand three times. Others[3] rule that in such a case washing one time suffices, although one who washes three times is blessed. Practically it is not necessary to be stringent to wash one’s hands three times. Furthermore, some Poskim[4] rule that regarding today’s bathrooms one may be lenient not to wash the hands at all in such a case.
[1] Torah Leshma 23; Lev Chaim 4:2; Ruach Chaim 3:3; Kaf Hachaim 3:3 and 4:66; Mishneh Yosef 5:6; Yabia Omer 9:108
[2] Ruach Chaim 3:3
[3] Ben Ish Chaiy Toldos 16 brought in Kaf Hachaim 4:66
[4] Lehoros Nasan 7:1; Tzitz Eliezer 7:2; Piskeiy Teshuvos 4:20 footnote 200; See Daas Torah 4