I still get the same problem, even if I type nothing in the Serial Monitor window and I really don't understand why.
The, clearly, the problem isn't in the snippet you posted.
You have two choices. Post another snippet, and we'll try to guess what is wrong with the code you didn't post, or, post all of your code.