Add keepalive support

This adds keepalive support and caught a case where result_pdu came out nil
Why is `@open_connection.close` needed here? We're already testing if `@open_connection` is set above. Did you find a scenario where it was needed?