Adds onopen and onclose as options