Preventing Panel widget from firing close events on page change

Preventing Panel widget from firing close events on page change

I've got some functions in the close event. This is getting fired every time I load a page via Ajax. If I have Ajax disabled, the close event is not fired.

The issue here is these functions fire when the close event fires; which in this particular case, is inside the pageshow event. Any thoughts here on how to prevent that?

Here's the code:
  1. $(document).delegate('[data-role="page"]', 'pageshow', function() {
  2.       $('#side-panel').panel({
  3.             beforeopen: function() {
  4.                   updateOpenClose($('.nav-toggle'));
  5.                   updateDeviceToggle();
  6.             },
  7.             close: function() {
  8.                   updateOpenClose($('.nav-toggle'));
  9.                   updateDeviceToggle();
  10.             }
  11.       });
  12. });