There may be a problem powering the servo from the Arduino. It is best to give the servo its own power supply with a common ground with the Arduino. If the servo draws too much current from the Arduino there can be very strange behaviour and possible damage to the Arduino.
As you have a problem your code is too complex - it has two parts in it myServo.write(180) followed by myServo.write(90).
When you have a problem test it with the simplest possible code. Drop the second write() and see what happens. Change the 180 to other values and see if it behaves properly.
If all works well with just a single write() then reinstate the second write() and increase the delay() to see what effect that has.
Power is probably the #1 suspect.
...R