workaround for onClose and open PORT
polishing for pause functionality