updated shutdown if port isnt open.