You can check for errors at the bottom of the loop. The <> operator will return undef on errors which ends the loop and sets $!. The other way to find errors is to check the return status of close.
open RESTART, "x:\\myfiles\file.txt" or die;
while (<RESTART>) {
}
die "Read error: $!" if $!;
close(RESTART) or die "Close error: $!";