added writeURL function to create temporary documents with URLs