updated to handle transition when already open/closed better