A train line in Devon is set to close while work is carried out to repair a giant sinkhole that appeared near the railway.