The proceedings under a writ of habeas corpus, including all the papers in the cause, and the final order, shall be returned by the judge to the nearest court served by that judge, to be filed there by the clerk, as other records, a brief memorandum thereof, duly indexed, being made upon the judgment or execution docket, and such clerk taxing the costs and issuing execution therefor, as in other cases.