Close standard input for debug commands
(cherry picked from commit 79c20b6207ac1432631f905a6340a338a16fe4fc)