Using trap for cleanup in shell scripts

trap … EXIT does not always trigger if the script is terminated by a signal