Ditto for this function. Clean up the resources before you return.