allow file instances as paramter of the writeXXXfile methods