Open and Close Refs

Added if statement to allow reference tags to be closed on second click