Add method for writing an index to a custom location.