Make `close()` support transition setting.

`close()` function shouldn't animate if transition was set to 'none'.