Fix resource leak when offline file send