Fixed resource leak in backend.