finish pipe test
add checks for invalid handles