Implemented proper lifecycle for the serial connection tasks.