TRQ-2664. Revise the fix to not remove the on close function.