Exit functionality, and fixed problem with freeing history (first input was not malloced)