Transform.Rotate not stopping?

When I'm rotating my spaceship with this script, it keeps rotating when I don't want it to.

var turnSpeed = 15.0;

function Update () {
    transform.Rotate(Vector3.forward, Input.GetAxis("Horizontal") * turnSpeed, Space.Self);
    transform.Rotate(Vector3.right, Input.GetAxis("Vertical") * turnSpeed, Space.Self);
}

I want the spaceship to stop turning right when I don't press "d". Is there anything that might help in my script?

That code is framerate-dependent; you need to multiply input by Time.deltaTime. There's nothing that would make it keep rotating though. Maybe you have a joystick connected that needs calibrating.