Add exception when closing stdin and stderr