Iím not a teacher.
With a verbs and word-groups both the gerund and the infinitive may be used. It is sometimes possible to find a reason for the use of a given form. With some verbs and word-groups, such as to be afraid, to forget, to like (dislike), to prefer the infinitive is mostly used with reference to a special occasion, the gerund being more appropriate to a general statement.
The child was not afraid of remaining alone, but he was afraid to remain alone on such a stormy night.
Donít forget shutting the window when you leave home.
Donít forget to shut the window when you leave home, it is very windy to-day.