Arduino Nano acting strainge when disconnecting from PC

You don't have current limiting resistors for your LED.