added trap for last command so as to not slow down the prompt