siggen: make sure all resources are freed after finishing