 		Files.createFile(atPath: path.path!, contents: nil, attributes: nil)
 	}
 
-	let filehandle = try NSFileHandle(forWritingTo: path)
-	filehandle.seekToEndOfFile()
-	return WriteableStream(filehandle, encoding: encoding)
+	do {
+		let filehandle = try NSFileHandle(forWritingTo: path)
+		filehandle.seekToEndOfFile()
+		return WriteableStream(filehandle, encoding: encoding)
+	} catch {
+		try FileError.checkFile(path.path!)
+		throw error
+	}
 }
 
 /**


/** Open a file for reading, throw if an error occurs. */
public func open (_ path: NSURL, encoding: NSStringEncoding = main.encoding) throws -> ReadableStream {
	return ReadableStream(try NSFileHandle(forReadingFrom: path), encoding: encoding)
}

/**

- parameter overwrite: If true, replace the file if it exists.
*/
public func open (forWriting path: String, overwrite: Bool = false, encoding: NSStringEncoding = main.encoding) throws -> WriteableStream {
	return try open(forWriting: NSURL(fileURLWithPath: path, isDirectory: false), overwrite: overwrite, encoding:  encoding)
}
