Fixed error when trying to flush closed standard input