add close statement in all resources