fixed issue where listener wasnt being closed