Three men died when a train derailed near Stonehaven in Aberdeenshire following heavy rain in 2020.