Prevent reopening panel when button is clicked