Fixes the console sometimes receiving text after it was closed