Fix process terminating on close