A road will be closed overnight for a number of days while work is carried out on a level crossing.