You can't have them both open on the same port at the same time.
So if you had PuTTY open and then tried to upload new code from the ide, the ide can't connect.
So close PuTTY, upload the code, make sure serial monitor's not open, then open PuTTY.
The fact that you got a message in PuTTY shows it was connected, and was receiving whatever the pre-existing sketch was sending.