added closing procedure for serial line

Forgot to add the procedure to close the serial line