pack script with cleanup