Deleting the config file
.spyder-py3
From the system and restarting Spyder worked for me. I did try restarting kernel but again it kept looping around with IOStream.flush timeout error again.
if its mac this file should be in ~/Users/user/.config/.spyder-py3 or just as ~/Users/user/.spyder-py3