Make sure readline is closed upon exiting the prompt