Commented the write line for the pseudo terminal. It hangs the program after a while.