 public class GalleryViewController : UIPageViewController, UIViewControllerTransitioningDelegate, ImageViewControllerDelegate  {
     
     //UI
-    private var closeButton: UIButton!
+    private var closeButton: UIButton?
     public var headerView: UIView?
     public var footerView: UIView?
     

    public override func viewDidLayoutSubviews() {
        super.viewDidLayoutSubviews()
        
        closeButton.frame.origin = CGPoint(x: self.view.frame.size.width - closeButton.frame.size.width - closeButtonPadding, y: closeButtonPadding)
        
        layoutHeaderView()
        layoutFooterView()

            
            let alpha = 1 - distance * swipeToDissmissFadeOutAccelerationFactor
            
            closeButton?.alpha = alpha
            headerView?.alpha = alpha
            footerView?.alpha = alpha
        }
