use closest instead of parent

This allows you to wrap other elements around the .close button without breaking the script.