Copy over some of the Numpy file-handing compatibility functions.
Update backend_agg to use the Numpy file-handling compatibility functions.