title: Readline on closed filehandle
body: <p>I'm using this sub for my prgram to wait up to several hours for a task to finish what it's doing on windows.
  When the windows task finishes, it updates a string in a text file to let the Linux script know that Windows is done. </p>
  
  <p>I get this error while it's running:
  readline() on closed filehandle</p>
  
  <p>Here is the sub</p>
  
  <pre><code>my $numberOfChecks = 28;
  my $sleepTime = 900;
  my $communicationsFile = "/home/user/ICAhome/Win_To_Linux_ComFile.txt";
  my $winBuild = "1";
  
  sub waitForWindowsBuild {
      while ($numberOfChecks-- $$ $winBuild == "1"){
          open (MYFILE, $communicationsFile);
  
          while (&lt;MYFILE&gt;){
              chomp;
              if ($_ eq $buildValue){
                  $winBuild="1";
              }
  
              sleep($sleepTime);
          }
  
          close(MYFILE);
      }
  } 
  </code></pre>
  
  <p>Could anyone tell me what's going on?</p>
  
  <p>Thanks!</p>