Lift mallocing & freeing to the generic hFILE code

Inevitably we had forgotten to free the hFILE struct in each of
the backends.