anchor.diff:  }
   
   void testDirectoryInNonExistentDirectory() {
  -  var file = new File("${tempDir().path}/nonExistentDirectory/newFile");
  +  Directory temp = tempDir();
  +  ReceivePort p = new ReceivePort();
  +  p.receive((x, y) {
  +    p.close();
  +    temp.deleteRecursivelySync();
  +  });
  +  var file = new File("${temp.path}/nonExistentDirectory/newFile");
   
     // Create in non-existent directory should throw exception.
     Expect.throws(() => file.directorySync(),
                   (e) => checkDirectoryInNonExistentDirectoryException(e));
   
     file.directory((directory) => Expect.fail("Unreachable code"));
  -  file.onError = (e) => checkDirectoryInNonExistentDirectoryException(e);
  +  file.onError = (e) {
  +    checkDirectoryInNonExistentDirectoryException(e);
  +    p.toSendPort().send(null);
  +  };
   }
   
   void testReadAsBytesNonExistent() {
  -  var file = new File("${tempDir().path}/nonExistentFile3");
  +  Directory temp = tempDir();
  +  ReceivePort p = new ReceivePort();
  +  p.receive((x, y) {
  +    p.close();
  +    temp.deleteRecursivelySync();
  +  });
  +  var file = new File("${temp.path}/nonExistentFile3");
   
     // Non-existing file should throw exception.
     Expect.throws(() => file.readAsBytesSync(),
                   (e) => checkOpenNonExistentFileException(e));
   
     file.readAsBytes((data) => Expect.fail("Unreachable code"));
  -  file.onError = (e) => checkOpenNonExistentFileException(e);
  +  file.onError = (e) {
  +    checkOpenNonExistentFileException(e);
  +    p.toSendPort().send(null);
  +  };
   }
   
   void testReadAsTextNonExistent() {
  -  var file = new File("${tempDir().path}/nonExistentFile4");
  +  Directory temp = tempDir();
  +  ReceivePort p = new ReceivePort();
  +  p.receive((x, y) {
  +    p.close();
  +    temp.deleteRecursivelySync();
  +  });
  +  var file = new File("${temp.path}/nonExistentFile4");
   
     // Non-existing file should throw exception.
     Expect.throws(() => file.readAsTextSync(),
                   (e) => checkOpenNonExistentFileException(e));
   
     file.readAsText(Encoding.ASCII, (data) => Expect.fail("Unreachable code"));
  -  file.onError = (e) => checkOpenNonExistentFileException(e);
  -}
  -
  -void testReadAsLinesNonExistent() {
  -  var file = new File("${tempDir().path}/nonExistentFile5");
  +  file.onError = (e) {
  +    checkOpenNonExistentFileException(e);
  +    p.toSendPort().send(null);
  +  };
  +}
  +
  +testReadAsLinesNonExistent() {
  +  Directory temp = tempDir();
  +  ReceivePort p = new ReceivePort();
  +  p.receive((x, y) {
  +    p.close();
  +    temp.deleteRecursivelySync();
  +  });
  +  var file = new File("${temp.path}/nonExistentFile5");
   
     // Non-existing file should throw exception.
     Expect.throws(() => file.readAsLinesSync(),
                   (e) => checkOpenNonExistentFileException(e));
   
     file.readAsLines(Encoding.ASCII, (data) => Expect.fail("Unreachable code"));
  -  file.onError = (e) => checkOpenNonExistentFileException(e);
  +  file.onError = (e) {
  +    checkOpenNonExistentFileException(e);
  +    p.toSendPort().send(null);
  +  };
   }
   
   bool checkWriteReadOnlyFileException(e) {
  
positive.code: testWriteByteToReadOnlyFile() {
    Directory temp = tempDir();
    ReceivePort p = new ReceivePort();
    p.receive((x,y) {
      p.close();
      temp.deleteRecursivelySync();
    });
  
negative.code: testWriteListToReadOnlyFile() {
    Directory temp = tempDir();
    ReceivePort p = new ReceivePort();
    p.receive((x, y) {
      p.close();
      temp.deleteRecursivelySync();
    });
  