Code now checks if user is in Edit Mode

If the operator is called while in Edit Mode, then the script will not
take the user to Object Mode after executing.